1 21 package oracle.toplink.essentials.platform.server; 23 24 import java.io.*; 25 import oracle.toplink.essentials.internal.helper.*; 26 import oracle.toplink.essentials.exceptions.*; 27 import oracle.toplink.essentials.logging.*; 28 29 41 public class ServerLog extends AbstractSessionLog { 42 43 49 public ServerLog() { 50 super(); 51 setLevel(INFO); 52 } 53 54 63 public void log(SessionLogEntry entry) { 64 if (!shouldLog(entry.getLevel())) { 65 return; 66 } 67 68 String message = getSupplementDetailString(entry); 69 70 if (entry.hasException()) { 71 message += entry.getException(); 72 } else { 73 message += formatMessage(entry); 74 } 75 76 basicLog(entry.getLevel(), message); 77 } 78 79 89 protected void basicLog(int level, String message) { 90 try { 91 printPrefixString(level); 92 getWriter().write(message); 93 getWriter().write(Helper.cr()); 94 getWriter().flush(); 95 } catch (IOException exception) { 96 throw ValidationException.logIOError(exception); 97 } 98 } 99 } 100 | Popular Tags |