[jcifs] Redirect the JCIFS log to a log file

Mohan Radhakrishnan mohanr at fss.co.in
Thu Jun 3 01:37:58 MDT 2010


Hi Del,
           It is really very useful !!

           We have been facing intermittent SAN access failures and our
admins. Refuse to install packet capture software. Hopefully I can debug
this.

What is the optimal level of log for a production system without
overwhelming the system ?

Thanks,
Mohan

-----Original Message-----
From: Del Merritt [mailto:del at alum.mit.edu] 
Sent: Wednesday, June 02, 2010 8:43 PM
To: Mohan Radhakrishnan
Cc: jcifs at lists.samba.org
Subject: Re: [jcifs] Redirect the JCIFS log to a log file

Mohan wrote:
>     Is there a way to redirect the JCIFS ( -Djcifs.util.loglevel=10 or
> any other sufficient level ) to a log file ?

If you are willing to write a smidge of code, then you can call:

   jcifs.util.LogStream.setInstance( ps );

where "ps" is a PrintStream object; it defaults to System.err.  You have
to make the call before jCIFS cranks up.

Note that as implemented, all logging will go to that PrintStream; you
cannot currently filter it to different destinations.  To make that
happen, create your own class that extends PrintStream and you can
override the write() method(s) as needed.

-Del



More information about the jCIFS mailing list