logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Widdis <wid...@gmail.com>
Subject Re: Migrating from log4j 1x to 2x
Date Wed, 04 Mar 2015 00:58:09 GMT
You are correct that you need to convert your .properties file to an xml 
file.

When I did this, I started with the sample xml files for the appenders 
and just added in the items from the properties file one by one.   
Instead of redundant sequential lines for nested properties like this:
   foo.bar=abc
   foo.baz=xyz
you'll generally nest xml like this:
   <foo>
      <bar=abc>
      <baz=xyz>
   </foo>

It's pretty easy to pick up, and this is coming from someone who was 
afraid of the xml to start.  I now like the xml much better!

You might also find tools like this useful: 
https://code.google.com/p/log4j-properties-converter/

Dan

On 3/3/15 3:18 PM, Mangat Rai wrote:
> Hello,
> We are using log4j 1x in our application which we want to migrate to log4j 2.
> i want to understand few things.
> At moment we have a log4j.properties file which we load at the start of application using
PropertyConfigurator method
> PropertyConfigurator.configure(log4jPropFileName);
> log4j property file looks something like this
> ######################################################################log4j.logger.Common.Logger=DEBUG,Common.Loggerlog4j.additivity.Common.Logger=falselog4j.appender.Common.Logger=org.apache.log4j.DailyRollingFileAppenderlog4j.appender.Common.Logger.File=E:\\SoftwareAG\\appLogs\\Common\\common.loglog4j.appender.Common.Logger.layout=org.apache.log4j.PatternLayoutlog4j.appender.Common.Logger.layout.ConversionPattern=%d{yyyy-MM-dd
HH:mm:ss:SSS zzz -} %-5p %m%nlog4j.appender.Common.Logger.DatePattern='.'yyyyMMddlog4j.appender.Common.Logger.MaxFileSize=10MBlog4j.appender.Common.Logger.MaxBackupIndex=10######################################################################
> within application we maintain different log files for different functions.
> what i understand from v2 documentation is that i no more need to load configuration
at start of application.
> Also i understand that i need to change configuration and put them in xml file.
> could you guys please help me in understand this? how can i convert my log4j property
file to work with new log4j v2.
> Thanks in Advance.
> Regards,Mangat Rai
>   		 	   		


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message