You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Bill Milbratz <Bm...@participate.com> on 2002/07/19 17:47:21 UTC

how to append to different output files on the fly

I would like log4j to direct output statements to various output files based
on application variables.

e.g., for user defined process 12345 (where 12345 is an arbitrary ID
generated by our application.), I'd like this statement:
  logger.debug("....");
to write to file12345.log.

Any recommendations on the best approach (e.g. extending FileAppender,
extending WriterAppender)?  

The mechanism needs to:
  get the ID from the application...(passed via  threadlocal?)
  open and write to the correct file.
  close the file.

The application could run in a clustered environment, so two separate
machines could try to write to the same file at once. Our files would be
shared (nfs or win2k share) so that the server would have local access to
them.

We could conceivably use jdbcappender also. We're currently using log4j
1.1.3 though could go to 1.2.5.

I'd appreciate any suggestions.

thanks in advance,

bill milbratz



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>