logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Levy, Jeremy" <Jeremy.L...@morganstanley.com>
Subject RE: Different client's log file?
Date Fri, 11 Aug 2006 20:18:46 GMT
James,

That was perfect, I have extended it to log to separate directories based on a MDC value as
well as name the file based on the MDC value and append today's date.

I have posted the version I am now using at:

http://jeremylevy.com/MDCFileAppender.java

Jeremy 

-----Original Message-----
From: James Stauffer [mailto:stauffer.james@gmail.com] 
Sent: Friday, August 11, 2006 11:21 AM
To: Log4J Users List
Subject: Re: Different client's log file?

Yes.  I made an Appender that changes the filename based on the time.
You could change it based on anything in the LoggingEvent.
http://stauffer.james.googlepages.com/DateFormatFileAppender.java

On 8/11/06, Levy, Jeremy <Jeremy.Levy@morganstanley.com> wrote:
> In my application, we have the consumer pass in the name of the application that is using
our service.
>
> So we generally only have about 4,5 consumers.  This is small enough that we can manually
add them to the properties file.  However, as our utility grows I don't want to have to maintain
or add appenders to the properties file.
>
> Is it possible to dynamically change the file name of a log file based on a value?
>
> So if someone calls a web service, if I call getLogger or maybe MDC/NDC is there a way
to change the name of the log file based a value passed in at runtime?
>
> Jeremy
>
> -----Original Message-----
> From: Javier Gonzalez [mailto:jagonzal@gmail.com]
> Sent: Thursday, August 10, 2006 1:23 AM
> To: Log4J Users List
> Subject: Re: Different client's log file?
>
> On 8/10/06, wolverine my <wolverine.my@gmail.com> wrote:
> > Hi!
> >
> > I'm actually developing a web application using servlet and so I can 
> > use the client's IP address instead of the client.getName()...
>
> Ah, a web application... no way to know beforehand every single client's id.
>
> mmm, I don't think you can have a log file per client, but maybe you can still include
the ip address in the logger name. That way, you can grep over the logs with the ip address
of a given client to study just that client's activity.
>
> --
> Javier González Nicolini
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
> --------------------------------------------------------
>
> Important Notice to Recipients:
> It is important that you do not use e-mail to request, authorize or effect the purchase
or sale of any security or commodity, to send fund transfer instructions, or to effect any
other transactions. Any such request, orders, or instructions that you send will not be accepted
and will not be processed by Morgan Stanley.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
 
 
 
--------------------------------------------------------

Important Notice to Recipients:
It is important that you do not use e-mail to request, authorize or effect the purchase or
sale of any security or commodity, to send fund transfer instructions, or to effect any other
transactions. Any such request, orders, or instructions that you send will not be accepted
and will not be processed by Morgan Stanley.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message