When using the following:
<log path='${resin.home}/logs/cluster.log'
               timestamp="[%H:%M:%S.%s]"
         formatter="org.apache.solr.cluster.ClusterLogFormatter" 
rollover-period="1D">
    <logger name='org.apache.solr' level='all'/>
    <logger name='org.apache.lucene' level='all'/>
  </log>

Where org.apache.solr.cluster.ClusterLogFormatter extends 
java.util.logging.Formatter.  Get this error:

[17:49:24.453] com.caucho.config.LineConfigException: WEB-INF/web.xml:16: java.l
ang.IllegalAccessException: Class com.caucho.config.BeanTypeStrategy can not acc
ess a member of class java.util.logging.Formatter with modifiers "protected"

----------------------------------------------------------------------------------


package org.apache.solr.cluster;

import java.util.logging.*;
import java.io.*;
import java.text.*;
import java.util.Date;
import java.sql.SQLException;
import java.util.concurrent.locks.*;
import org.apache.commons.lang.exception.*;
import org.apache.commons.dbutils.DbUtils;

/**
 * Prints out full stack traces of all nested exceptions
 *
 * @author jasonr
 */
public class ClusterLogFormatter extends java.util.logging.Formatter {
  Date dat = new Date();
  private final static String format = "{0,date} {0,time}";
  private MessageFormat formatter;
  private ReentrantLock lock = new ReentrantLock();
  
  private Object args[] = new Object[1];
  
  public static void main(String[] args) {
    LogManager logManager = LogManager.getLogManager();
    //logManager.
  }
  
  // Line separator string.  This is the value of the line.separator
  // property at the moment that the SimpleFormatter was created.
  private String lineSeparator = (String) 
java.security.AccessController.doPrivileged(
          new sun.security.action.GetPropertyAction("line.separator"));
  
  
  public ClusterLogFormatter() {
    super();
  }
  
  public String format(LogRecord record) {
    lock.lock();
    try {
      StringBuffer sb = new StringBuffer();
      // Minimize memory allocations here.
      dat.setTime(record.getMillis());
      args[0] = dat;
      StringBuffer text = new StringBuffer();
      if (formatter == null) {
        formatter = new MessageFormat(format);
      }
      formatter.format(args, text, null);
      sb.append(text);
      sb.append(" ");
      if (record.getSourceClassName() != null) {
        sb.append(record.getSourceClassName());
      } else {
        sb.append(record.getLoggerName());
      }
      if (record.getSourceMethodName() != null) {
        sb.append(" ");
        sb.append(record.getSourceMethodName());
      }
      sb.append(lineSeparator);
      String message = formatMessage(record);
      sb.append(record.getLevel().getLocalizedName());
      sb.append(": ");
      sb.append(message);
      sb.append(lineSeparator);
      if (record.getThrown() != null) {
        Throwable throwable = record.getThrown();
        if (throwable instanceof SQLException) {
          SQLException sqlException = (SQLException)throwable;
          StringWriter stringWriter = new StringWriter();
          DbUtils.printStackTrace(sqlException, new PrintWriter(stringWriter));
          sb.append(stringWriter.toString());
        } else {
          String string = ExceptionUtils.getFullStackTrace(throwable);
          sb.append(string);
        }
        /**
         * try {
         * StringWriter sw = new StringWriter();
         * PrintWriter pw = new PrintWriter(sw);
         * record.getThrown().printStackTrace(pw);
         * pw.close();
         * sb.append(sw.toString());
         * } catch (Exception ex) {
         * }
         **/
      }
      return sb.toString();
    } finally {
      lock.unlock();
    }
  }
}

_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to