{"id":71,"date":"2012-08-29T07:34:48","date_gmt":"2012-08-29T07:34:48","guid":{"rendered":"http:\/\/softwareeveryday.wordpress.com\/?p=71"},"modified":"2012-08-29T07:34:48","modified_gmt":"2012-08-29T07:34:48","slug":"in-log4j-output-info-logs-of-classes-only-from-your-package","status":"publish","type":"post","link":"https:\/\/www.softwareeverydayblog.com\/?p=71","title":{"rendered":"In log4j, output INFO logs of classes only from your package."},"content":{"rendered":"<p>Been awhile since\u00a0I&#8217;ve\u00a0been using log4j for most of my projects. I wanted to output INFO statements only from my package and block log statements from all other packages i was using. Using the following log4j.properties you will see only ERROR statements from other packages and INFO statements from your package.<\/p>\n<blockquote><p>#Give root logger ERROR level, so that we get only ERROR output from &#8216;other&#8217; packages<br \/>\nlog4j.rootLogger=ERROR, stdout<\/p>\n<p>#Only appender is stdout<br \/>\nlog4j.appender.stdout=org.apache.log4j.ConsoleAppender<br \/>\nlog4j.appender.stdout.layout=org.apache.log4j.PatternLayout<\/p>\n<p># Pattern to output the caller&#8217;s file name and line number.<br \/>\nlog4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) &#8211; %m%n<\/p>\n<p>#Give all loggers in my package INFO level, so that we see get all our messages<br \/>\nlog4j.logger.my.com.package=INFO<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Been awhile since\u00a0I&#8217;ve\u00a0been using log4j for most of my projects. I wanted to output INFO statements only from my package and block log statements from all other packages i was using. Using the following log4j.properties you will see only ERROR statements from other packages and INFO statements from your package. #Give root logger ERROR level, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-71","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts\/71","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=71"}],"version-history":[{"count":0,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts\/71\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=71"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=71"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}