users@glassfish.java.net

Quetions regarding Custom Log Handler in GlassFish 3.1

From: <forums_at_java.net>
Date: Tue, 13 Nov 2012 16:11:24 -0600 (CST)

Hi, We are currently using GlassFish 3.1 and sereral applications run on the
same server. I only own one application and when all applications write logs
to server.log file, it is hard to debug. I looked
http://weblogs.java.net/blog/carlavmott/archive/2008/12/adding_custom_h.html
and it suggests us to write a Custom Log Handler. Before introducing a Custom
Log Handler to my application, I would like to know if following features are
supported in GlassFish 3.1. 1. If it is configurable loggers that want to
write to my own log file through GlassFish Admin console. I don't want to
hardcode it like bellow. public void publish(LogRecord record) { if
(getFilter() != null) { if (!getFilter().isLoggable(record)) return; } try {
if (webLogger.equals(record.getLoggerName()) ||
deployLogger.equals(record.getLoggerName())) { f.write("NewHandler output -
"); f.write("logger name: " + record.getLoggerName()); f.write(" source
classname: " + record.getSourceClassName()); f.write(" message: " +
record.getMessage()); f.newLine(); f.flush(); } } catch (IOException ex) {
System.out.println("not able to write to log file." + ex); } } 2. I like to
set size of my log file through Admin console. I am pretty new to GlassFish.
I would appreciate if someone guide me on this. Thanks in advance.

--
[Message sent by forum member 'gchoi']
View Post: http://forums.java.net/node/892253