Or, you can use placeholders in your config file.
log4j.appender.RollingFile.File = /var/log/${application}.log
and each application can then use a different value for the system property:
app1: System.setPropert("application", "app1") or java -Dapplication=app1
...
app2: System.setPropert("application", "app2")
Maarten
On Fri, Feb 15, 2008 at 3:08 PM, orko <[EMAIL PROTECTED]> wrote:
> Hi there,
> You can create multiple appenders in the same configuration file. Suppose
> you want 4 log files, and all DailyRollingFileAppender, all you need to is
> create 4 appenders (it is exactly same as creating one appender), then point
> them to diff files based on log levels. You can control applications through
> loggers. Just add your appender name in the property 'appender-ref
> ref="YourAppender"' of a particular logger (may be based on your
> applications). You will get very good resources in log4j site under
> Publications link about how to create appenders and loggers.
> Good luck!
> -OrkO
>
>
>
> sparky2708 <[EMAIL PROTECTED]> wrote:
> I have a system developed in java that has multiple services (i.e. java
> Applications). I would like to be able to log EACH application to ITS OWN
> log file. I have about 50-80 applications so having a log4j.properties for
> each one is not a feasible solution. I would like to use ONE
> log4j.properties file for the entire suite of application and use the
> "DailyRollingFileAppender" preferably to roll each of the log files on a
> nightly basis so each of the logs doesn't get too big.
> I didn't think this would be very complicated when I started thinking
> about this but am now stuck trying to figure out how to accomplish this
> with
> log4j. Any ideas?
> --
> View this message in context:
> http://www.nabble.com/Can%27t-figure-out-how-to-log-to-separate-files-in-Log4J----Need-Ideas-tp15501211p15501211.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>