Methods Summary |
---|
public java.util.logging.Handler | createLogHandler()Create a log handler object.
String fileName = getLogFileName();
Handler h = null;
try {
if (fHandler == null) {
fHandler = new FileHandler(fileName, true);
}
} catch (Exception e) {
// If there is an exception in creation of file handler,
// use a console handler instead.
// NOI18N
System.err.println("Error creating log handler for " + fileName
+ ". Using ConsoleHandler -- " + e.getMessage());
e.printStackTrace();
h = new ConsoleHandler();
return h;
}
h = fHandler;
return h;
|
private static java.lang.String | getDefaultLogFileName()Get default log file name.
if (defaultLogFileName == null) {
ServerContext sc = ApplicationServer.getServerContext();
String instDir;
if (sc != null) {
instDir = sc.getInstanceEnvironment().getInstancesRoot();
} else {
// FIX: Use some other system property before user.dir
instDir = System.getProperty("user.dir");
}
String[] names = {instDir, LOGS_DIR, LOG_FILE};
defaultLogFileName = StringUtils.makeFilePath(names, false);
}
return defaultLogFileName;
|
private static java.lang.String | getLogFileName()Get log file name. If a log file name is defined in configuration
then the method returns that value, otherwise it returns default
log file name.
if (logFileName == null) {
ServerContext sc = ApplicationServer.getServerContext();
if (sc != null) {
ConfigContext ctx = sc.getConfigContext();
LogService ls = null;
try {
ls = ServerBeansFactory.getConfigBean(ctx).getLogService();
} catch (ConfigException ce) {
// Ignore this exception, intent is to use default file
// NOI18N
System.err.println("Error accessing log service config -- "
+ ce.getMessage() + "\nUsing default file");
ce.printStackTrace();
}
if (ls != null) {
logFileName = ls.getFile();
}
}
}
if (logFileName != null) {
return logFileName;
} else {
return getDefaultLogFileName();
}
|