Reputation: 2558
I'm using log4j in a project that is being deployed to a clustered Weblogic 11g environment, and I'm trying to get the name of the server that has the app deployed on it to use for logs. I seem to remember that there is a way to get the running server name, but it is escaping me... here is the line from my log4j config for where I want to send the log output:
log4j.appender.MyRollingAppender.File=servers/${weblogic.Name}/logs/serverName.log
Right now everything is going into serverName.log
for each server, but I would like to have the output go into a server specific file, i.e, server1.log
for activity on server 1 and server2.log
on server 2.
Upvotes: 2
Views: 2679
Reputation: 24910
Use the variable instead of a static file name
log4j.appender.MyRollingAppender.File=servers/${weblogic.Name}/logs/${weblogic.Name}.log
Upvotes: 4