Skip to main content

Quetions regarding Custom Log Handler in GlassFish 3.1

1 reply [Last post]
Joined: 2012-03-19


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 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 through GlassFish Admin console about loggers that want to write to my own log file . I don't want to hardcode it like bellow.

public void publish(LogRecord record) {
if (getFilter() != null) {
if (!getFilter().isLoggable(record))
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());
} 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.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2013-10-11

I don't know if this could be still useful for you, but I just published an extension for GF3 and GF4 that allows full customization of Log Handlers in Glassfish Admin Console. You can find my project at