Methods Summary |
---|
public int | getLevel(java.lang.String category)
if(category != null) {
Integer logLevel = categoryLogLevelMap.get(category);
// if category-specific log level is not set, use parent level.
if(logLevel != null) {
return logLevel.intValue();
}
}
return level;
|
public java.lang.String | getWriterFilename()PUBLIC:
For the given writer, return it's associated filename.
If associated writer does not have a filename, return null.
return fileName;
|
protected void | initialize(java.io.Writer writer)Initialize the log.
this.writer = writer;
|
public synchronized void | log(oracle.toplink.essentials.logging.SessionLogEntry entry)INTERNAL:
Log the entry.
This writes the log entries information to a writer such as System.out or a file.
This must be synchronized as it will be called by many threads in three-tier.
if (!shouldLog(entry.getLevel(), entry.getNameSpace())) {
return;
}
try {
printPrefixString(entry.getLevel());
this.getWriter().write(getSupplementDetailString(entry));
if (entry.hasException()) {
if (entry.getLevel() == SEVERE) {
entry.getException().printStackTrace(new PrintWriter(getWriter()));
} else if (entry.getLevel() <= WARNING) {
if (shouldLogExceptionStackTrace()) {
entry.getException().printStackTrace(new PrintWriter(getWriter()));
} else {
writeMessage(entry.getException().toString());
}
}
} else {
writeMessage(formatMessage(entry));
}
getWriter().write(Helper.cr());
getWriter().flush();
} catch (IOException exception) {
throw ValidationException.logIOError(exception);
}
|
public void | setLevel(int level, java.lang.String category)
if(category == null) {
this.level = level;
} else if(categoryLogLevelMap.containsKey(category)) {
categoryLogLevelMap.put(category, level);
}
|
public void | setWriter(java.lang.String aFileName)PUBLIC:
Set the writer that will receive the
formatted log entries for a file name.
if (aFileName != null) {
try {
this.writer = new FileWriter(aFileName);
this.fileName = aFileName;
} catch (IOException e) {
e.printStackTrace();
}
}
|
public boolean | shouldLog(int level, java.lang.String category)PUBLIC:
Check if a message of the given level would actually be logged by the logger
with name space built from the given session and category.
Return the shouldLog for the given category from
return (getLevel(category) <= level);
|
protected void | writeMessage(java.lang.String message)Append the specified message information to the writer.
this.getWriter().write(message);
|
protected void | writeSeparator()Append the separator string to the writer.
this.getWriter().write("--");
|