Пример #1
0
 public synchronized LogEvent log(LogEvent ev) {
   org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(ev.getRealm());
   if (logger.isEnabledFor(_level)) {
     ByteArrayOutputStream w = new ByteArrayOutputStream();
     PrintStream p = new PrintStream(w);
     ev.dump(p, "");
     logger.log(_level, w.toString());
   }
   return ev;
 }
 public synchronized LogEvent log(LogEvent ev) {
   if (p != null) {
     if (permitLogging(ev.tag)) {
       Date d = new Date();
       p.println(
           "<log realm=\""
               + ev.getRealm()
               + "\" at=\""
               + d.toString()
               + "."
               + d.getTime() % 1000
               + "\">");
       ev.dump(p, "  ");
       p.println("</log>");
       p.flush();
     }
   }
   return ev;
 }