[jcifs] Redirect the JCIFS log to a log file

Del Merritt del at alum.mit.edu
Wed Jun 2 09:13:04 MDT 2010

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.


More information about the jCIFS mailing list