I am playing with Wonder because we are planning to migrate our applications in order to take advantage of all its features.
Using this interface we can simply turn on / off Debug logs, stdout (For development) and we can change the application log's root path directory.
Once you click on "Aplicar" (Apply changes, not exit) or "Guardar" (Save changes and exit) we save changes on database and run a function that rebuild the log4j properties and load them.
Error Appender is a file appender and just register erros.
-------------------------------------------- CODE ---------------------------------------------
String log4JRootLogger = "ErrorAppender";
if (logsDebugValue()) {
log4JRootLogger += ", DebugAppender";
}
if (logsStdoutValue()) {
log4JRootLogger += ", stdout";
}
properties.setProperty("log4j.rootLogger", log4JRootLogger);
// //////////////////////////////////////
if (logsDebugValue()) {
properties.setProperty("log4j.appender.DebugAppender","org.apache.log4j.DailyRollingFileAppender");
properties.setProperty("log4j.appender.DebugAppender.file", pathLogs + "appDebug.log");
properties.setProperty("log4j.appender.DebugAppender.datePattern", "'.'yyyy-MM-dd");
properties.setProperty("log4j.appender.DebugAppender.append","true");
properties.setProperty("log4j.appender.DebugAppender.layout","org.apache.log4j.PatternLayout");
properties.setProperty("log4j.appender.DebugAppender.layout.ConversionPattern","%-5p %d{dd-MMM-yyyy HH:mm:ss} [%t] - %m%n");
properties.setProperty("log4j.appender.DebugAppender.threshold","DEBUG");
}
if (logsStdoutValue()) {
properties.setProperty("log4j.appender.stdout","org.apache.log4j.ConsoleAppender");
properties.setProperty("log4j.appender.stdout.layout","org.apache.log4j.PatternLayout");
properties.setProperty("log4j.appender.stdout.layout.ConversionPattern","%-5p [%t] - %m%n");
if (logsDebugValue()) {
properties.setProperty("log4j.appender.stdout.threshold","DEBUG");
} else {
properties.setProperty("log4j.appender.stdout.threshold","INFO");
}
}
// ///////////////////////////////////////
properties.setProperty("log4j.appender.ErrorAppender","org.apache.log4j.FileAppender");
properties.setProperty("log4j.appender.ErrorAppender.file", pathLogs+ "appError.log");
properties.setProperty("log4j.appender.ErrorAppender.append", "true");
properties.setProperty("log4j.appender.ErrorAppender.layout","org.apache.log4j.PatternLayout");
properties.setProperty("log4j.appender.ErrorAppender.layout.ConversionPattern", "%-5p %d{dd-MMM-yyyy HH:mm:ss} [%t] - %m%n");
properties.setProperty("log4j.appender.ErrorAppender.threshold","ERROR");
if(logsDebugValue()){
properties.setProperty("log4j.logger.com.toracom.app", "DEBUG");
}
else{
properties.setProperty("log4j.logger.com.toracom.app", "INFO");
}
properties.setProperty("log4j.logger.org.apache", "WARN");
PropertyConfigurator.configure(properties);
-------------------------------------------- CODE END ---------------------------------------------
The problem is that once I prepare the application for working with Wonder.
If we select the Debug and Stdout options we revive output logs like these:
DEBUG [WorkerThread4] - inserted WebObject with Name 'FileUpload1'.
DEBUG [WorkerThread4] - inserted WebObject with Name 'ImageButton3'.
DEBUG [WorkerThread4] - inserted WebObject with Name 'Conditional1'.
DEBUG [WorkerThread4] - inserted WebObject with Name 'Image1'.
DEBUG [WorkerThread4] - inserted WebObject with Name 'ImageButton1'.
DEBUG [WorkerThread4] - inserted WebObject with Name 'TextField2'.
DEBUG [WorkerThread4] - inserted WebObject with Name 'GenericContainer1'.
DEBUG [WorkerThread4] - inserted WebObject with Name 'ComponentContent1'.
DEBUG [WorkerThread4] - inserted WebObject with Name 'Div1'.
One for each WOObject / WOComponent that is inserted in the main component that is being accessed. This makes difficult for reading our debug logs and it looks that it is affecting the response velocity of the application
I am not a log4j expert, does anybody know what can be happening?
By the way I set all logger in the Properties file to ERROR trying to find if there was the problem, but not, I was worng.
# Log4j Configuration
log4j.loggerFactory=er.extensions.logging.ERXLogger$Factory
log4j.rootCategory=INFO,A1
log4j.appender.A1=er.extensions.logging.ERXConsoleAppender
log4j.appender.A1.layout=er.extensions.logging.ERXPatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{MMM dd HH:mm:ss} %$[%#] %-5p %c %x - %m%n
# Log4j Categories
# Here are a few log4j sub-categories that are interesting.
# Don't forget that in developement mode this file will get reloaded
# everytime it changes, so if you say want to turn adaptor debugging
# on in the middle of the app simply set the below category to debug.
# Very handy.
# Base Category
log4j.logger.er=ERROR
# ERExtensions
# Transaction - Switching this to debug will start the sql ouputting.
log4j.logger.er.transaction.adaptor.EOAdaptorDebugEnabled=ERROR
# Fixes - Turning this on will show all the models that are loaded
log4j.logger.er.extensions.fixes.ERSharedEOLoader=ERROR
er.extensions.ERXNSLogLog4jBridge=ERROR
#log4j.logger.er.eo.ERXGenericRecord=DEBUG
#log4j.logger.er.validation.ERXEntityClassDescription=DEBUG
#log4j.logger.er.default.ERXEntityClassDescription=DEBUG
log4j.logger.er.extensions.ERXDatabaseContextDelegate=ERROR
log4j.logger.er.extensions.ERXConfigurationManager=ERROR
#log4j.logger.er.extensions.ERXApplication.RequestHandling=DEBUG
Ing. Miguel Angel Torres Avila