I answer a lot of log4j2 questions on StackOverflow, and there I actually still see quite a few people making the mistake of naming their config log4j.xml. I wrote "log4j configuration file" instead of "log4j2.xml" since we also support json and yaml config files. But capitalizing Log4j in this case might be confusing. So in this case I think log4j2 is better than log4j or Log4j.
On Wed, Aug 6, 2014 at 11:56 PM, Gary Gregory <[email protected]> wrote: > I think we should omit the version from the message: > > > LOGGER.error("No log4j2 configuration file found. Using default > configuration: logging only errors to the console."); > > -> > > LOGGER.error("No log4j configuration file found. Using default > configuration: logging only errors to the console."); > > Also, should it not be "Log4j" instead of "log4j"? > > Gary > > > On Wed, Aug 6, 2014 at 10:42 AM, <[email protected]> wrote: > >> Author: rpopma >> Date: Wed Aug 6 14:42:57 2014 >> New Revision: 1616252 >> >> URL: http://svn.apache.org/r1616252 >> Log: >> LOG4J2-729 Emit warning message to console if no configuration file found. >> >> Modified: >> >> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java >> logging/log4j/log4j2/trunk/src/changes/changes.xml >> >> Modified: >> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java >> URL: >> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java?rev=1616252&r1=1616251&r2=1616252&view=diff >> >> ============================================================================== >> --- >> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java >> (original) >> +++ >> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java >> Wed Aug 6 14:42:57 2014 >> @@ -434,7 +434,11 @@ public abstract class ConfigurationFacto >> } >> } >> } >> - return config != null ? config : new DefaultConfiguration(); >> + if (config != null) { >> + return config; >> + } >> + LOGGER.error("No log4j2 configuration file found. Using >> default configuration: logging only errors to the console."); >> + return new DefaultConfiguration(); >> } >> >> private Configuration getConfiguration(final boolean isTest, >> final String name) { >> >> Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml >> URL: >> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1616252&r1=1616251&r2=1616252&view=diff >> >> ============================================================================== >> --- logging/log4j/log4j2/trunk/src/changes/changes.xml (original) >> +++ logging/log4j/log4j2/trunk/src/changes/changes.xml Wed Aug 6 >> 14:42:57 2014 >> @@ -22,6 +22,9 @@ >> </properties> >> <body> >> <release version="2.0.2" date="2014-0?-??" description="Bug fixes >> and enhancements"> >> + <action issue="LOG4J2-729" dev="rpopma" type="fix"> >> + Emit warning message to console if no configuration file found. >> + </action> >> <action issue="LOG4J2-765" dev="rpopma" type="fix"> >> Improve warning message when missing log4j-core in the classpath. >> </action> >> >> >> > > > -- > E-Mail: [email protected] | [email protected] > Java Persistence with Hibernate, Second Edition > <http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory >
