{"id":6203,"date":"2012-08-24T13:34:07","date_gmt":"2012-08-24T08:04:07","guid":{"rendered":"https:\/\/2thenew.xyz\/blog\/?p=6203"},"modified":"2016-12-19T15:30:57","modified_gmt":"2016-12-19T10:00:57","slug":"manage-multiple-log-file","status":"publish","type":"post","link":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/","title":{"rendered":"Manage Multiple Log File"},"content":{"rendered":"<h4><strong> Different Levels of Logging to Different Appenders or Files:<\/strong><\/h4>\n<p style=\"padding:10px\">\n<p>When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In that case we manage more than one log files.<\/p>\n<p style=\"padding:10px\">\n<h5><strong>Two simple steps to define multiple log files according to log level priority:<\/strong><\/h5>\n<p style=\"padding:10px\">\n<p><strong>1<\/strong>. In <strong>appender block<\/strong> of<strong> log4j block<\/strong> in <strong>Config.groovy<\/strong>, add the appenders according to the number of log files. Here I have created two different log files, first one is for debug level logs and second one is for error level logs.<\/p>\n<p>[groovy]<br \/>\n\/**<br \/>\n  * In appenders block, generated log file name will be with file attribute,<br \/>\n  * and log level will define with threshold.<br \/>\n  **\/<br \/>\nappenders {<br \/>\n        rollingFile name:&#8217;debugLog&#8217;, file:&#8217;debug.log&#8217;, threshold: org.apache.log4j.Level.DEBUG<br \/>\n        rollingFile name:&#8217;errorLog&#8217;, file:&#8217;error.log&#8217;, threshold: org.apache.log4j.Level.ERROR<br \/>\n}<br \/>\n[\/groovy]<\/p>\n<p><strong>2.<\/strong> declare all the appenders in <strong>root block<\/strong> of<strong> log4j block<\/strong> in <strong>Config.groovy<\/strong> file as:<br \/>\n[groovy]<br \/>\nroot {<br \/>\n        info &#8216;debugLog&#8217;, &#8216;errorLog&#8217;<br \/>\n}<br \/>\n[\/groovy]<\/p>\n<p style=\"padding:10px\">\n<p>Thats it. \ud83d\ude42<\/p>\n<p style=\"padding:10px\">\n<p><strong>Note:<\/strong> When we are using log level files, then log level file will contain all that log level messages of that priority level and priority level above that.<\/p>\n<p>Amit Kumar<br \/>\n<a href=\"https:\/\/2thenew.xyz\/blog\/author\/amit.kumar\/\">amit.kumar@intelligrape.com<\/a><br \/>\nin.linkedin.com\/in\/amitkumar0110<br \/>\ntwitter.com\/amit_kumar0110<br \/>\n<strong><a href=\"https:\/\/2thenew.xyz\/blog\/author\/amit-kumar\/\">More Blogs by Me<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":9,"footnotes":""},"categories":[7],"tags":[4840,471,869,867],"class_list":["post-6203","post","type-post","status-publish","format-standard","hentry","category-grails","tag-grails","tag-log4j","tag-logfile","tag-multiple"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Amit Kumar\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Manage Multiple Log File | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Manage Multiple Log File | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/manage-multiple-log-file\\\/#article\",\"name\":\"Manage Multiple Log File | TO THE NEW Blog\",\"headline\":\"Manage Multiple Log File\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/amit-kumar\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2012-08-24T13:34:07+05:30\",\"dateModified\":\"2016-12-19T15:30:57+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/manage-multiple-log-file\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/manage-multiple-log-file\\\/#webpage\"},\"articleSection\":\"Grails, Grails, log4j, logfile, multiple\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/manage-multiple-log-file\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"position\":2,\"name\":\"Grails\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/manage-multiple-log-file\\\/#listItem\",\"name\":\"Manage Multiple Log File\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/manage-multiple-log-file\\\/#listItem\",\"position\":3,\"name\":\"Manage Multiple Log File\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/amit-kumar\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/amit-kumar\\\/\",\"name\":\"Amit Kumar\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/manage-multiple-log-file\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/859356966acd3c3879759369c7ac72cfb81228287bfc78e99c3080bee9b6b9ba?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Amit Kumar\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/manage-multiple-log-file\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/manage-multiple-log-file\\\/\",\"name\":\"Manage Multiple Log File | TO THE NEW Blog\",\"description\":\"Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/manage-multiple-log-file\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/amit-kumar\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/amit-kumar\\\/#author\"},\"datePublished\":\"2012-08-24T13:34:07+05:30\",\"dateModified\":\"2016-12-19T15:30:57+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Manage Multiple Log File | TO THE NEW Blog","description":"Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In","canonical_url":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/#article","name":"Manage Multiple Log File | TO THE NEW Blog","headline":"Manage Multiple Log File","author":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/amit-kumar\/#author"},"publisher":{"@id":"https:\/\/2thenew.xyz\/blog\/#organization"},"datePublished":"2012-08-24T13:34:07+05:30","dateModified":"2016-12-19T15:30:57+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/#webpage"},"articleSection":"Grails, Grails, log4j, logfile, multiple"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.xyz\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/grails\/#listItem","name":"Grails"}},{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/grails\/#listItem","position":2,"name":"Grails","item":"https:\/\/2thenew.xyz\/blog\/category\/grails\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/#listItem","name":"Manage Multiple Log File"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/#listItem","position":3,"name":"Manage Multiple Log File","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/grails\/#listItem","name":"Grails"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.xyz\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.xyz\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.xyz\/blog\/author\/amit-kumar\/#author","url":"https:\/\/2thenew.xyz\/blog\/author\/amit-kumar\/","name":"Amit Kumar","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/859356966acd3c3879759369c7ac72cfb81228287bfc78e99c3080bee9b6b9ba?s=96&d=mm&r=g","width":96,"height":96,"caption":"Amit Kumar"}},{"@type":"WebPage","@id":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/#webpage","url":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/","name":"Manage Multiple Log File | TO THE NEW Blog","description":"Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.xyz\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/amit-kumar\/#author"},"creator":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/amit-kumar\/#author"},"datePublished":"2012-08-24T13:34:07+05:30","dateModified":"2016-12-19T15:30:57+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.xyz\/blog\/#website","url":"https:\/\/2thenew.xyz\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.xyz\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Manage Multiple Log File | TO THE NEW Blog","og:description":"Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In","og:url":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/","og:image":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Manage Multiple Log File | TO THE NEW Blog","twitter:description":"Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In","twitter:image":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"6203","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 18:59:04","updated":"2024-02-29 09:30:27","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.xyz\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.xyz\/blog\/category\/grails\/\" title=\"Grails\">Grails<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tManage Multiple Log File\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.xyz\/blog"},{"label":"Grails","link":"https:\/\/2thenew.xyz\/blog\/category\/grails\/"},{"label":"Manage Multiple Log File","link":"https:\/\/2thenew.xyz\/blog\/manage-multiple-log-file\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/6203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/comments?post=6203"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/6203\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/media?parent=6203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/categories?post=6203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/tags?post=6203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}