String append = logManager.getProperty(baseName + ".append"); //NOI18N
if(append != null) {
defaultAppend = Boolean.valueOf(append).booleanValue();
}
FileHandler fileHandler = null;
try {
fileHandler = new FileHandler(pattern, defaultLimit,
defaultCount, defaultAppend);
}
catch(Exception e) {
MessageFormat messageFormat = new MessageFormat( getMessages().getString(
"errorlogger.filehandler.initialize.exception")); //NOI18N
getErrorLogger().log(Logger.WARNING,
messageFormat.format(new String[]{name}), e);
}
if(fileHandler != null) {
//Initialize various attributes for the new fileHandler
//--Level
String level = logManager.getProperty(baseName + ".level"); //NOI18N
if (level != null) {
try {
fileHandler.setLevel(Level.parse(level) );
}
catch(IllegalArgumentException e) {
}
}
//--Formatter
Formatter defaultFormatter = null;
//Initialize various attributes for the new fileHandler
String formatter = logManager.getProperty(baseName + ".formatter"); //NOI18N
if(formatter != null) {
try {
Class clz = ClassLoader.getSystemClassLoader().loadClass(formatter);
defaultFormatter = (Formatter) clz.newInstance();
} catch (Exception e) {
// We got one of a variety of exceptions in creating the
// class or creating an instance.
// Drop through.
MessageFormat messageFormat = new MessageFormat(
getMessages().getString("errorlogger.formatter.initialize.exception"));
getErrorLogger().log(Logger.WARNING, messageFormat.format(new String[]{name}), e);
}
}
if (defaultFormatter == null) {
defaultFormatter = new SimpleFormatter();
}
try {
fileHandler.setFormatter(defaultFormatter);
}
catch(IllegalArgumentException e) {
}
logger.addHandler(fileHandler);