Re: java.util.logger
On 9/9/2010 3:24 AM, gwoodhouse@gmail.com wrote:
After all this it turns out the single part of code i need to log is
being handled by some weird logger configured in a jar i have no
source for. Go figure.
You understand I had to modify code to get this to work, right?
Also, it occurs to me that if the app at some point does a mass logger
reset, this configuration will be overridden. If the app has some
"weird logger" then your options may be limited to modifying the code,
and trying to use logging.properties may not help.
Anyway, look up the "config" option in the LogManager. It just execute
arbitrary code in the named classes.
logging.properties:
config = my.classname.Here
Then in that class:
package my.classname;
public class Here {
public Here() {
Logger root = Logger.getLogger("");
root.addHandler( new FileHandler( "/tmp/var/logs/applog.log" );
Logger myLogger = Logger.getLogger( "my.otherpackage" );
myLogger.addHandler( new FileHandler( "/home/me/myapplog.log" );
}
}
Now this class needs to be accessible to the log manager as it runs the
app. You could manually add it to the Jar/War file, adjust the
classpath of the application via the command line, or put this class in
some global location.