AW: [SPAM (Bayesain Analysis)] - Log file per thread - Bayesian Filter detected spam

2009-05-04 Thread Bender Heri
Log4j distinguishes between Loggers and Appenders for a good reason:
  - Loggers define WHAT is logged (level, source)
  - Appenders define WHERE the log statement goes (console, file, etc.) and how 
it is formatted
You want to have a new file for each new thread, so this is an appender issue 
which you cannot solve by creating a new appender. 
Of course you can create a Logger as you suggested, but then you have to pass 
this logger instance along your callstack (or make it globally accessible in 
the current thread context). If you do so you will loose most of the benefits 
which log4j offers. You implement then something like your own logging 
framework, a thing which to avoid was the main goal of inventing log4j.
Follow the suggestion of Jake Kjome to search after this discussions in this 
mailing list and implement your RepositorySelector, based on MDC. There were 
even examples posted.
Heri


-Ursprüngliche Nachricht-
Von: Kaspar Fischer [mailto:fisch...@inf.ethz.ch] 
Gesendet: Samstag, 2. Mai 2009 16:54
An: log4j-user@logging.apache.org
Betreff: [SPAM (Bayesain Analysis)] - Log file per thread - Bayesian Filter 
detected spam

Dear list,

I am looking for a way to create a log file per thread (actually, per Quartz 
job that gets run).

I've googled quite a bit and found a few approaches, in particular 
KeyFileAppender [1]. All I have seen seem to rely on the MDC and 
KeyFileAppender seems to have a resource leak [2].

I am wondering whether there is a simply way to programmatically create, at the 
beginning of my thread, a logger with a given name and closing it at the end of 
the thread. Has anybody accomplished something like this?

   public void run()
   {
  String id = ...; // thread name or whatever
  Logger logger = ...; // Create a logger with a basename and the id
  try
  {
// ...
  }
  finally
  {
logger.close(); // Something like this is needed to make sure
// old logs do not keep hanging around
  }
   }

Many thanks,
Kaspar

[1] https://issues.apache.org/bugzilla/show_bug.cgi?id=19597
[2] http://www.mail-archive.com/log4j-user@logging.apache.org/msg07295.html

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



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



Access logfile logger

2009-05-04 Thread JasDA
Hi,

I'm using log4j with a DailyRollingFileAppender. Now I want to add some 
reporting functions to the same application that uses this appender. So I need 
to get access to the logfile that is written by the file appender. Only the 
current logfile needs to be read so is is possible via the logger instance?

Logger logger = Logger.getLogger(this.class);

Regards,
Jason


__
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


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



AW: Access logfile logger

2009-05-04 Thread Bender Heri
You cannot get access to the file object itself for reading purpose because the 
FileAppender uses a FileWriter class for writing to the file. But you can learn 
the file name where the appender writes to.
Not each logger instance which you get by Logger.getLogger() has appenders 
attached. Only the logger instances whose name is exactly as a configured one 
have in fact the appenders attached as configured. So, if your logger instance 
has no RollingFileAppender attached, you would have to ask the parent logger, 
and so on, until you find the desired appender. 
Since the appenders instances are singleton, it would be easier to ask the 
LogManager for all appenders and iterate on these to find your desired 
RollingFileAppender. Once you have found the correct appender instance, you 
cast it and ask it for the file name for use in a file reader object.
I am not sure about the lock mechanisme applied by a RollingFileAppender, if 
there are any. You have to try.
Heri

-Ursprüngliche Nachricht-
Von: ja...@web.de [mailto:ja...@web.de] 
Gesendet: Montag, 4. Mai 2009 14:57
An: log4j-user@logging.apache.org
Betreff: Access logfile logger

Hi,

I'm using log4j with a DailyRollingFileAppender. Now I want to add some 
reporting functions to the same application that uses this appender. So I need 
to get access to the logfile that is written by the file appender. Only the 
current logfile needs to be read so is is possible via the logger instance?

Logger logger = Logger.getLogger(this.class);

Regards,
Jason


__
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


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



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



RE: Call for feedback

2009-05-04 Thread Roberto Blanc
Hi Thorbjørn,

Thanks for your comment. In simple terms, what we do for making these logs 
tamper-evident is to process each line and then chain-hashing them. This means 
that any tampering in any record (even a single byte in one record) equals to 
an interruption in the hash chain, which allow us to pinpoint exactly where 
(e.g. in what event) this tampering has occurred. 

Are you thinking about any application for this type of solution?



-Original Message-
From: Thorbjørn Ravn Andersen [mailto:thunderax...@gmail.com] 
Sent: martes, 28 de abril de 2009 11:04
To: Log4J Users List
Subject: Re: Call for feedback

Roberto Blanc skrev  den 25-04-2009 19:00:
> while doing its job. It has the unique value of adding this
> tamper-evident "digital fingerprint" at the record level, which is
> impossible using other means such as digital signatures.
>   
Interesting.  Could you explain how this tamper-evident fingerprinting 
works?

-- 
  Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


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


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



Re: Access logfile logger

2009-05-04 Thread Yair Ogen
I think the approach should be via the appender. you can try and extend it -
AFAIK only the appender can give you the file name.

On Mon, May 4, 2009 at 3:56 PM,  wrote:

> Hi,
>
> I'm using log4j with a DailyRollingFileAppender. Now I want to add some
> reporting functions to the same application that uses this appender. So I
> need to get access to the logfile that is written by the file appender. Only
> the current logfile needs to be read so is is possible via the logger
> instance?
>
> Logger logger = Logger.getLogger(this.class);
>
> Regards,
> Jason
>
>
> __
> GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://movieflat.web.de
>
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


logging issue in application installed on clustered Weblogic Server

2009-05-04 Thread Ashish Kulkarni
HiWe have any application which is installed on a clustered Weblogic server,
there are 3 clusters on which this application is installed,

All the logs written by startup servlet are written to both A1 and STDOUT
appender, but then once the application is running logs are written to
STDOUT only

How do i find out what is happening and fix it

my log4j.xml file is as below




















I am noticis


Re: Access logfile logger

2009-05-04 Thread Simon Park
Hi Jason,

What are your requirements for "reporting functions"?  Do you need to discover 
statistics about the current log file?  I'm guessing, but it seems that the 
most useful statistic might be the current size of the log file.  I've outlined 
a possible way you might be able to get at that.

The RollingFileAppender uses the org.apache.log4j.helpers.CountingQuietWriter 
to keep track of the number of characters written to the FileOutputStream.  
DailyRollingAppender doesn't use the CountingQuietWriter, it uses a QuietWriter 
instead.  So maybe you could extend DailyRollingAppender: you could override 
the setQWForFiles(:Writer) method to use the CountingQuietWriter instead of the 
QuietWriter.  At that point you may fairly easily expose a method that will 
give you the current character count.

NB the CountingQuietWriter is not thread-safe, so if you want to access this 
property of the appender from a separate thread, you'll have to provide a 
synchronized version of the CountingQuietWriter (I've already written one of 
these - let me know if you'd like the source).

Cheers,

Simon





From: "ja...@web.de" 
To: log4j-user@logging.apache.org
Sent: Monday, 4 May, 2009 13:56:54
Subject: Access logfile logger

Hi,

I'm using log4j with a DailyRollingFileAppender. Now I want to add some 
reporting functions to the same application that uses this appender. So I need 
to get access to the logfile that is written by the file appender. Only the 
current logfile needs to be read so is is possible via the logger instance?

Logger logger = Logger.getLogger(this.class);

Regards,
Jason


__
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


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