Author Message
BalaSriram
Joined: Dec 23, 2013
Messages: 0
Offline
Hi

Is it possible for me to convert the ddlog4j.properties file to an XML file (ddlog4j.xml). I need to use the "filter" classes that are supported by Log4J. Our application requires logging data into various files (and even a DB using JDBC appenders). Having Log4j.properties as a XML file helps me to have properties "LevelMin" and "LevelMax" that will help me in writing only info messages into the file that is delegated for Info logging. Warn, Error, Debug will not be printed into this file (even the logging levels are higher than INFO).

I tried to change the ddlog4j.properties and make it as an xml property file, but struck with "log4j.appender.Dialog.Designer.TracerWriter.appLog" as the appender name.

Is it possible or the DD logger component doesnt support?

Anybody had given it a try?

Thanks
Bala Sriram
ErikJohnson2
Joined: Jan 18, 2006
Messages: 0
Offline
You can't change the name of the file -- it must remain ddlog4j.properties because the runtime uses that file when it sets up the loggers.

You are free, to some extent, to change the contents of the file and add/modify appenders, etc.
The only thing that is required is that DD runtime needs to have the loggers:
- log4j.logger.Dialog.Designer.TraceWriter.<app>
- log4j.logger.Dialog.Designer.ReportWriter.<app>
because it loads those loggers by name for trace/reporting.

You could probably try to set the contents of the ddlog4j.properties with XML content, but you cannot rename the file.

It's worth experimenting with the caveat "you break it, you buy it" :)
JessieSheng2
Joined: Jul 28, 2008
Messages: 0
Offline
One of our customer has the same need to only direct the info messages into a file that is delegated for Info logging. This file is used for reporting extract to database later. Warn and Error should not be printed into this file (even the logging levels are higher than INFO). Searching online, it seems Log4J filter class setting only works from the xml file, not working from the properties file. I did a test and verified it is not working from the properties file setting. If Dialog Designer only supports the ddlog4j.properties file, is there any way to only log the info messages into a reporting file?

Thank you,
Jessie
AmirAliakbar
Joined: Apr 26, 2011
Messages: 0
Offline
Hi

Instead of Opening a new topic I was wondering if there is way to filter as the previous poster has asked.

We need to filter report file have two separate report files. when only for Info and one for warning+error.Using ddlog4j properties file.

Thanks in advance
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
You should be able to do that by modifying the ddlog4j.properties file to add a new appender. For example:

log4j.logger.Dialog.Designer.TraceWriter.TestMain= debug, TTestMain, NewAppender

log4j.appender.NewApperder=org.apache.log4j.DailyRollingFileAppender
log4j.appender.TTestMain.File=${dd.apphome}/data/log/trace1.log
log4j.appender.TTestMain.DatePattern='.'yyyy-MM-dd
log4j.appender.TTestMain.layout=org.apache.log4j.PatternLayout
log4j.appender.TTestMain.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss:SSS} %5p - %m%n
log4j.appender.TTestMain.Encoding=UTF-8

log4j.appender.NewAppender.Threshold = WARN


There is a lot of flexibility with log4j. The only thing you can't change is the logger name "log4j.logger.Dialog.Designer.TraceWriter.TestMain"
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
correction:

log4j.appender.NewApperder=org.apache.log4j.DailyRollingFileAppender
log4j.appender.NewApperde.File=${dd.apphome}/data/log/trace1.log
log4j.appender.NewApperde.DatePattern='.'yyyy-MM-dd
log4j.appender.NewApperde.layout=org.apache.log4j.PatternLayout
log4j.appender.NewApperde.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss:SSS} %5p - %m%n
log4j.appender.NewApperde.Encoding=UTF-8
AmirAliakbar
Joined: Apr 26, 2011
Messages: 0
Offline
Thanks for the quick Reponse Wilson. I'll test this see how it goes.
Go to:   
Mobile view