Panayappan Periyakaruppan

Greenhorn
+ Follow
since May 30, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Panayappan Periyakaruppan

Thanks Senthil and Peter.

@Peter - we are using jboss-5.1.0.GA

@Senthil - thanks for the reference link. It is a requirement that we need individual log file and hence individual log4j properties. For different apps, we might adjust log levels as and when required. That is, changing log level for one app should not affect log levels of other applications.

We will experiment the suggestion as in the reference link above and given an update.


Here is the log4j properties that we use.



log4j.rootCategory=INFO, R

#### First appender writes to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%p] %c{1} %m%n

#### Second appender writes to a file
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${PROJ_HOME}/runtime/log/app1.log

# Control the maximum log file size
log4j.appender.R.MaxFileSize=100KB
# Archive log files (one backup file here)
log4j.appender.R.MaxBackupIndex=1

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n
10 years ago
We have two JBoss instances running at the same time
(For ex:
App1.war running under %JBOSS_HOME%/server/JBoss_Instance1 and
App2.war running under %JBOSS_HOME%/server/JBoss_Instance2

on the SAME machine)

Both these apps have their own LoggerClass to access Log4j instance. (We have this class in the workspace and at ANT-Build time this class goes into both the Apps' war). Structure of Class attached at the end.

Both Apps have their own ServletContextListeners which initializes their respective Loggerclasses at respective JBoss start up.

The problem is:
Both Apps creates/initializes their app.log files but only one of them succeeds in logging while other doesn't.

The way we access in our code where we need to log is -

SomeLogger logger = SomeLogger.getLogger();
/*some logic*/
logger.logInfo("ClassName.API","Log Message");

Workaround:
We created LoggerClass1 for App1 and LoggerClass2 for App2 (except different name for class, they both are identical)- Things worked awesome

Could there be a problem at the JBoss-Log4j configuration, that we are missing? Or does logging of apps in JBoss is handled at Container level rather than App level?

Any pointer or directions would be of great help.



10 years ago