关闭javapns.Push.combined调试模式

时间:2014-07-02 14:06:15

标签: iphone apple-push-notifications javapns

我正在使用javapns并且它工作正常但每次发送通知时,它都会记录填充我的日志文件的所有内容。如何停止记录javapns的活动?这是我的代码

BasicConfigurator.configure();
ArrayList<String> devices = new ArrayList<String>();
devices.add("deviceID");
Push.combined ("Test Notification...", 1, "bingbong.aiff", "ssl_cert.p12", "password",true, devices);

(我已将生产模式设为true)。

由于

1 个答案:

答案 0 :(得分:0)

JavaPN使用log4j进行日志记录。

您可以使用此配置文件停止它:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration>
 <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
   <layout class="org.apache.log4j.PatternLayout">
     <param name="ConversionPattern" value="%d{ABSOLUTE} 
      %5p %c{1}:%L - %m%n"/>
   </layout>
 </appender>
 <root>
    <priority value="OFF"></priority>
    <appender-ref ref="stdout"/>
 </root>
</log4j:configuration>

<priority value="OFF"></priority>停止所有日志记录。 您可以选择以下任何日志记录级别:

  /**
     The <code>OFF</code> has the highest possible rank and is
     intended to turn off logging.  */
  final static public Level OFF = new Level(OFF_INT, "OFF", 0);

  /**
     The <code>FATAL</code> level designates very severe error
     events that will presumably lead the application to abort.
   */
  final static public Level FATAL = new Level(FATAL_INT, "FATAL", 0);

  /**
     The <code>ERROR</code> level designates error events that
     might still allow the application to continue running.  */
  final static public Level ERROR = new Level(ERROR_INT, "ERROR", 3);

  /**
     The <code>WARN</code> level designates potentially harmful situations.
  */
  final static public Level WARN  = new Level(WARN_INT, "WARN",  4);

  /**
     The <code>INFO</code> level designates informational messages
     that highlight the progress of the application at coarse-grained
     level.  */
  final static public Level INFO  = new Level(INFO_INT, "INFO",  6);

  /**
     The <code>DEBUG</code> Level designates fine-grained
     informational events that are most useful to debug an
     application.  */
  final static public Level DEBUG = new Level(DEBUG_INT, "DEBUG", 7);

  /**
    * The <code>TRACE</code> Level designates finer-grained
    * informational events than the <code>DEBUG</code level.
   *  @since 1.2.12
    */
  public static final Level TRACE = new Level(TRACE_INT, "TRACE", 7);


  /**
     The <code>ALL</code> has the lowest possible rank and is intended to
     turn on all logging.  */
  final static public Level ALL = new Level(ALL_INT, "ALL", 7);