{"id":14996,"date":"2017-04-14T10:09:29","date_gmt":"2017-04-14T08:09:29","guid":{"rendered":"https:\/\/blog.trifork.com\/?p=14996"},"modified":"2017-04-14T10:09:29","modified_gmt":"2017-04-14T08:09:29","slug":"how-to-send-your-spring-batch-job-log-messages-to-a-separate-file","status":"publish","type":"post","link":"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/","title":{"rendered":"How to send your Spring Batch Job log messages to a separate file"},"content":{"rendered":"\n<p>In one of my current projects we&#8217;re developing a web application which also has a couple of dozen batch jobs that perform all sort of tasks at particular times. These jobs produce quite a bit of logging output when they&#8217;re run, which is important to see what has happened during a job exactly. What we noticed however, is that the batch logging would make it hard to quickly spot the other logging performed by the application while also running a batch job. In addition to that, it wasn&#8217;t always clear in the context of what job a log statement was issued.<br \/>To address these issues I came up with a simple solution based on Logback Filters, which I&#8217;ll describe in this blog.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Logback Appenders<\/h2>\n\n\n\n<p>We&#8217;re using <a rel=\"noopener\" href=\"https:\/\/logback.qos.ch\/\" target=\"_blank\">Logback<\/a> as a logging framework. Logback defines the concept of <a rel=\"noopener\" href=\"https:\/\/logback.qos.ch\/manual\/appenders.html\" target=\"_blank\">appenders<\/a>: appenders are responsible for handling the actual log messages emitted by the loggers in the application by writing them to the console, to a file, to a socket, etc.<br \/>Many applications define one or more appenders and them simply list them all as part of their root logger section in the logback.xml configuration file:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; gutter: false; title: ; notranslate\" title=\"\">\n&lt;configuration scan=&quot;true&quot;&gt;\n  &lt;appender name=&quot;LOGSTASH&quot; class=&quot;net.logstash.logback.appender.LogstashTcpSocketAppender&quot;&gt;\n    &lt;destination&gt;logstash-server&lt;\/destination&gt;\n    &lt;encoder class=&quot;net.logstash.logback.encoder.LogstashEncoder&quot;\/&gt;\n  &lt;\/appender&gt;\n  &lt;appender name=&quot;FILE&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;\n    &lt;file&gt;log\/server.log&lt;\/file&gt;\n    &lt;rollingPolicy class=&quot;ch.qos.logback.core.rolling.TimeBasedRollingPolicy&quot;&gt;\n      &lt;fileNamePattern&gt;log\/server.%d{yyyy-MM-dd}.log&lt;\/fileNamePattern&gt;\n      &lt;maxHistory&gt;30&lt;\/maxHistory&gt;\n    &lt;\/rollingPolicy&gt;\n    &lt;encoder&gt;\n      &lt;pattern&gt;%d{yyyy-MM-dd HH:mm:ss.SSS} &#x5B;%thread] %mdc %-5level %logger{36} - %msg%n&lt;\/pattern&gt;\n    &lt;\/encoder&gt;\n  &lt;\/appender&gt;\n  &lt;root level=&quot;info&quot;&gt;\n    &lt;appender-ref ref=&quot;LOGSTASH&quot;\/&gt;\n    &lt;appender-ref ref=&quot;FILE&quot;\/&gt;\n  &lt;\/root&gt;\n&lt;\/configuration&gt;\n<\/pre><\/div>\n\n\n<p>This setup will send all log messages to both of the configured appenders.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>You can also configure loggers to use a specific appender. We use this in some applications to for example write all SOAP-related logging to a dedicated file, as we don&#8217;t want to pollute our regular logs with tons of SOAP messages but still want to capture those messages:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; gutter: false; title: ; notranslate\" title=\"\">\n...\n&lt;appender name=&quot;SOAP&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;\n  &lt;file&gt;log\/soap.log&lt;\/file&gt;\n  ...\n&lt;\/appender&gt;\n&lt;logger name=&quot;org.springframework.ws.client.MessageTracing&quot; level=&quot;trace&quot; additivity=&quot;false&quot;&gt;\n  &lt;appender-ref ref=&quot;SOAP&quot;\/&gt;\n&lt;\/logger&gt;\n&lt;logger name= &quot;org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor&quot; level=&quot;debug&quot; additivity=&quot;false&quot;&gt;\n  &lt;appender-ref ref=&quot;SOAP&quot;\/&gt;\n&lt;\/logger&gt;\n&lt;root level=&quot;info&quot;&gt;\n  &lt;appender-ref ref=&quot;FILE&quot;\/&gt;\n&lt;\/root&gt;\n<\/pre><\/div>\n\n\n<p>By specifying the appender-ref inside the logger element and using additivity=&#8221;false&#8221; we ensure that the output of the SOAP-related loggers is sent <strong>only<\/strong> to the SOAP appender. Note that this appender is <strong>not<\/strong> listed inside the root element.<\/p>\n\n\n\n<p>In many situations these options provide you with sufficient ammunition to handle your problems.<\/p>\n\n\n\n<p>In the situation with Batch Job logging, however, this won&#8217;t work: there isn&#8217;t just a single logger category that will be used for all batch-related logging, and many loggers could be used both in the context of a batch job and outside such a context. So how to tackle this? Enter Logback <em>Filters<\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Logback Filters<\/h2>\n\n\n\n<p>Another feature provided by Logback is <a href=\"https:\/\/logback.qos.ch\/manual\/filters.html\" target=\"_blank\" rel=\"noopener\">Filters<\/a>. You can declare one or more filters inside of an appender: each filter can determine if a log message (more precisely: a log <em>event<\/em>) should be passed on to the appender, or if it should be filtered out. Several useful implementations are provided out of the box, but it&#8217;s easy to define your own as well.<\/p>\n\n\n\n<p>In our situation, we want to have a filter that we can configure to do one of two things: filter out all batch-related log messages, or filter out all <em>non<\/em>-batch-related logging. Then we can add that filter to two separate file appenders: one exclusively for all the batch logging, and one for all the other logging.<\/p>\n\n\n\n<p>Here&#8217;s an initial implementation of our Logback Filter (imports are implied)<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\npublic class LogbackBatchFilter extends Filter&lt;ILoggingEvent&gt; {\n  static final String MDC_KEY = &quot;batch-job&quot;;\n  private Mode mode = Mode.EXCLUDE_BATCH;\n  public void setMode(Mode mode) {\n     this.mode = mode;\n  }\n  @Override\n  public FilterReply decide(ILoggingEvent iLoggingEvent) {\n    boolean runningBatchJob = ...; \/\/ how to determine this?\n    if (mode == Mode.EXCLUDE_BATCH &amp;&amp; runningBatchJob ||\n        mode == Mode.BATCH_ONLY &amp;&amp; !runningBatchJob)\n    {\n      return FilterReply.DENY;\n    }\n    return FilterReply.NEUTRAL;\n  }\n  enum Mode {\n    BATCH_ONLY,\n    EXCLUDE_BATCH\n  }\n}\n<\/pre><\/div>\n\n\n<p>This filter can be configured to run in two modes: by default it will filter out all batch messages, using an EXCLUDE_BATCH mode. However, when it&#8217;s running in BATCH_ONLY mode it does exactly the opposite and filters out all non-batch-related messages.<br \/>The NEUTRAL reply means we&#8217;re not filtering out the given logging event in our filter, but there might still be another filter down the filter chain that decides to filter it out anyway: ACCEPT instead of NEUTRAL would mean that we&#8217;re short-circuiting such a filter chain if there are additional filters, which is not what we&#8217;re after here.<\/p>\n\n\n\n<p>To use the filter, you simply add it within your appender config:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; gutter: false; title: ; notranslate\" title=\"\">\n&lt;appender name=&quot;FILE&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;\n  &lt;filter class=&quot;nl.trifork.batch.LogbackBatchFilter&quot;\/&gt;\n  &lt;file&gt;log\/server.log&lt;\/file&gt;\n  ...\n&lt;\/appender&gt;\n&lt;appender name=&quot;FILE-BATCH&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;\n  &lt;filter class=&quot;nl.trifork.batch.LogbackBatchFilter&quot;&gt;\n     &lt;mode&gt;BATCH_ONLY&lt;\/mode&gt;\n  &lt;\/filter&gt;\n  &lt;file&gt;log\/batch.log&lt;\/file&gt;\n  ....\n&lt;\/appender&gt;\n&lt;root level=&quot;info&quot;&gt;\n  &lt;appender-ref ref=&quot;FILE&quot; \/&gt;\n  &lt;appender-ref ref=&quot;FILE-BATCH&quot; \/&gt;\n&lt;\/root&gt;\n<\/pre><\/div>\n\n\n<p>Easy, right?<br \/>There\u2019s just one little unresolved detail: how do we determine the value of the runningBatchJob flag inside the decide method?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Revisiting the Mapped Diagnostic Context<\/h2>\n\n\n\n<p><a href=\"https:\/\/www.slf4j.org\/\" target=\"_blank\" rel=\"noopener\">SLF4J<\/a>, the logging API implemented by Logback, defines the concept of a <em>Mapped Diagnostic Context<\/em> (MDC) which can hold String-based key-value pairs associated with the current thread, which can be included in your logging output. I\u2019ve <a href=\"https:\/\/blog.trifork.com\/2013\/06\/06\/adding-user-info-to-log-entries-in-a-multi-user-app-using-mapped-diagnostic-context\/\" target=\"_blank\" rel=\"noopener\">blogged about this before<\/a> in the context of security, to ensure that every log message contains the current user name.<\/p>\n\n\n\n<p>You can also access the MDC properties in a Logback Filter: they\u2019re available directly from the ILoggingEvent that&#8217;s passed in. So, if we could set an MDC key whenever we&#8217;re running a batch job, then that could tell us whether we should be excluding log messages inside the filter.<br \/>How to make this happen?<\/p>\n\n\n\n<p>In our application we&#8217;re using Spring Batch&#8217;s SimpleJobLauncher to start all Batch Jobs. This launcher can be configured with a TaskExecutor to run the job on a separate thread, typically obtained from some thread pool.<br \/>We want to achieve two things:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>When the launcher&#8217;s run method is called, we want to set the name of the job that will run as an MDC entry, and clear that entry when the method is done;<\/li><li>When the job runs in a separate thread, we want have the same MDC entry set there as well.<\/li><\/ol>\n\n\n\n<p>These two things combined will ensure that <strong>all<\/strong> logging performed in the context of running a batch job will have the expected MDC entry.<br \/>What I ended up doing was subclassing that SimpleJobLauncher to inject some MDC-related code:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\n\/**\n * SimpleJobLauncher subclass which ensures that an MDC key {@code batch-job}\n * will be set with the name of the job to be run, both in the current thread\n * as well as in the thread used by a custom configured {@link TaskExecutor}.\n * This in turn enables filtering of log messages issued in the context of\n * batch jobs.\n *\/\npublic class MDCPopulatingJobLauncher extends SimpleJobLauncher {\n static final String MDC_KEY = &quot;batch-job&quot;;\n @Override\n public JobExecution run(Job job, JobParameters jobParameters)\n     throws JobExecutionAlreadyRunningException, JobRestartException,\n            JobInstanceAlreadyCompleteException, JobParametersInvalidException {\n   MDC.put(MDC_KEY, job.getName());\n   try {\n     return super.run(job, jobParameters);\n   } finally {\n     MDC.remove(MDC_KEY);\n   }\n }\n  @Override\n  public void setTaskExecutor(TaskExecutor taskExecutor) {\n     super.setTaskExecutor(\n       new MDCPopulatingTaskExecutorDecorator(taskExecutor));\n  }\n  private static class MDCPopulatingTaskExecutorDecorator\n                       implements TaskExecutor {\n    private TaskExecutor targetExecutor;\n    MDCPopulatingTaskExecutorDecorator(TaskExecutor targetExecutor) {\n      this.targetExecutor = targetExecutor;\n    }\n    @Override\n    public void execute(Runnable task) {\n      String mdcValue = MDC.get(MDC_KEY);\n      targetExecutor.execute(() -&gt; {\n        MDC.put(MDC_KEY, mdcValue);\n        try {\n          task.run();\n        } finally {\n          MDC.remove(MDC_KEY);\n        }\n      });\n    }\n  }\n}\n<\/pre><\/div>\n\n\n<p>So, this gives us the missing piece of the puzzle to complete the Filter:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><pre class=\"brush: java; light: true; title: ; notranslate\" title=\"\">boolean runningBatchJob = iLoggingEvent.getMDCPropertyMap().containsKey(MDC_KEY);<\/pre><\/pre>\n\n\n\n<p>(This assumes that we\u2019re doing a static import of that MDC_KEY constant)<\/p>\n\n\n\n<p>Now you simply configure a Spring Bean of type MDCPopulatingJobLauncher instead of SimpleJobLauncher in your Batch configuration class or XML file and you&#8217;re done! As a bonus, you can include the name of the currently executing batch job in your batch logging by referencing it in your pattern through %X{batch-job}.<\/p>\n\n\n\n<p>Note that for appenders like the Logstash one shown earlier which include the full MDC, you probably don&#8217;t need the filter as you could filter in Kibana or Graylog or whatever you&#8217;re using based on the presence of the batch-job MDC entry directly.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/bit.ly\/3BAo305\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"256\" src=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1024x256.png\" alt=\"\" class=\"wp-image-20303\" srcset=\"https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1024x256.png 1024w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-300x75.png 300w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-768x192.png 768w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1536x384.png 1536w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-2048x512.png 2048w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1920x480.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>In one of my current projects we&#8217;re developing a web application which also has a couple of dozen batch jobs that perform all sort of tasks at particular times. These jobs produce quite a bit of logging output when they&#8217;re run, which is important to see what has happened during a job exactly. What we [&hellip;]<\/p>\n","protected":false},"author":62,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[88,337,31],"tags":[11,437,338,70],"class_list":["post-14996","post","type-post","status-publish","format-standard","hentry","category-devops","category-from-the-trenches","category-java","tag-java","tag-logback","tag-mdc","tag-spring"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to send your Spring Batch Job log messages to a separate file - Trifork Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to send your Spring Batch Job log messages to a separate file - Trifork Blog\" \/>\n<meta property=\"og:description\" content=\"In one of my current projects we&#8217;re developing a web application which also has a couple of dozen batch jobs that perform all sort of tasks at particular times. These jobs produce quite a bit of logging output when they&#8217;re run, which is important to see what has happened during a job exactly. What we [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/\" \/>\n<meta property=\"og:site_name\" content=\"Trifork Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-14T08:09:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1024x256.png\" \/>\n<meta name=\"author\" content=\"Joris Kuipers\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Joris Kuipers\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/\",\"url\":\"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/\",\"name\":\"How to send your Spring Batch Job log messages to a separate file - Trifork Blog\",\"isPartOf\":{\"@id\":\"https:\/\/trifork.nl\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1024x256.png\",\"datePublished\":\"2017-04-14T08:09:29+00:00\",\"author\":{\"@id\":\"https:\/\/trifork.nl\/blog\/#\/schema\/person\/265bd41e503f7176742258a927de598b\"},\"breadcrumb\":{\"@id\":\"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/#primaryimage\",\"url\":\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1024x256.png\",\"contentUrl\":\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1024x256.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/trifork.nl\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to send your Spring Batch Job log messages to a separate file\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/trifork.nl\/blog\/#website\",\"url\":\"https:\/\/trifork.nl\/blog\/\",\"name\":\"Trifork Blog\",\"description\":\"Keep updated on the technical solutions Trifork is working on!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/trifork.nl\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/trifork.nl\/blog\/#\/schema\/person\/265bd41e503f7176742258a927de598b\",\"name\":\"Joris Kuipers\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/trifork.nl\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9ab8da0d60582bad84342d4602d23dbd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9ab8da0d60582bad84342d4602d23dbd?s=96&d=mm&r=g\",\"caption\":\"Joris Kuipers\"},\"sameAs\":[\"http:\/\/www.trifork.nl\"],\"url\":\"https:\/\/trifork.nl\/blog\/author\/jorisk\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to send your Spring Batch Job log messages to a separate file - Trifork Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/","og_locale":"en_US","og_type":"article","og_title":"How to send your Spring Batch Job log messages to a separate file - Trifork Blog","og_description":"In one of my current projects we&#8217;re developing a web application which also has a couple of dozen batch jobs that perform all sort of tasks at particular times. These jobs produce quite a bit of logging output when they&#8217;re run, which is important to see what has happened during a job exactly. What we [&hellip;]","og_url":"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/","og_site_name":"Trifork Blog","article_published_time":"2017-04-14T08:09:29+00:00","og_image":[{"url":"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1024x256.png","type":"","width":"","height":""}],"author":"Joris Kuipers","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Joris Kuipers","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/","url":"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/","name":"How to send your Spring Batch Job log messages to a separate file - Trifork Blog","isPartOf":{"@id":"https:\/\/trifork.nl\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/#primaryimage"},"image":{"@id":"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/#primaryimage"},"thumbnailUrl":"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1024x256.png","datePublished":"2017-04-14T08:09:29+00:00","author":{"@id":"https:\/\/trifork.nl\/blog\/#\/schema\/person\/265bd41e503f7176742258a927de598b"},"breadcrumb":{"@id":"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/#primaryimage","url":"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1024x256.png","contentUrl":"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2022\/02\/Blog-Banner-1-1024x256.png"},{"@type":"BreadcrumbList","@id":"https:\/\/trifork.nl\/blog\/how-to-send-your-spring-batch-job-log-messages-to-a-separate-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/trifork.nl\/blog\/"},{"@type":"ListItem","position":2,"name":"How to send your Spring Batch Job log messages to a separate file"}]},{"@type":"WebSite","@id":"https:\/\/trifork.nl\/blog\/#website","url":"https:\/\/trifork.nl\/blog\/","name":"Trifork Blog","description":"Keep updated on the technical solutions Trifork is working on!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/trifork.nl\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/trifork.nl\/blog\/#\/schema\/person\/265bd41e503f7176742258a927de598b","name":"Joris Kuipers","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/trifork.nl\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9ab8da0d60582bad84342d4602d23dbd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9ab8da0d60582bad84342d4602d23dbd?s=96&d=mm&r=g","caption":"Joris Kuipers"},"sameAs":["http:\/\/www.trifork.nl"],"url":"https:\/\/trifork.nl\/blog\/author\/jorisk\/"}]}},"_links":{"self":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/posts\/14996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/users\/62"}],"replies":[{"embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/comments?post=14996"}],"version-history":[{"count":0,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/posts\/14996\/revisions"}],"wp:attachment":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/media?parent=14996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/categories?post=14996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/tags?post=14996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}