Log4j Dynamic Parameter
- by cedric
Hi. i have a j2ee web application running on spring framework and using log4j for logging. I have this line in my log4j.properties file. this will insert the logs in my database. How do I set a dynamic value in the message part so that I can somehow append the currently logged in user. The bean object containing info for the current user is in the application context.
log4j.appender.dbLog.sql = INSERT INTO
LOGGING (log_date, log_level,
location, message) VALUES
('%d{yyyy/MM/dd HH:mm:ss}', '%-5p',
'%C-%L', '%m')