2

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.

Reporter
  • 3,897
  • 5
  • 33
  • 47
bakoyaro
  • 2,550
  • 3
  • 36
  • 63
  • Why not just use the variable name instead of a static logfile name ? `/${weblogic.Name}/logs/${weblogic.Name}.log` – Kal Nov 07 '11 at 15:24
  • @Kal ID-10-T moment on my part, I don't know where my mind is today. Pose your question in the form of an answer and I will accept it, and vote it up. – bakoyaro Nov 07 '11 at 15:47

1 Answers1

4

Use the variable instead of a static file name

log4j.appender.MyRollingAppender.File=servers/${weblogic.Name}/logs/${weblogic.Name}.log
Kal
  • 24,724
  • 7
  • 65
  • 65