zoukankan      html  css  js  c++  java
  • 把JXSE的日志输出到控制台

    Displaying additional log information

    If your JXTA application isn't behaving as you expect, you can turn on additional logging so that more information is displayed when your application runs.

    The  JavaDoc for the net.jxta.logging.Logging class provides complete instructions and examples for enabling detailed logging information.

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

    net.jxta.logging.Logging
     

    This class defines constants for JXTA JSE's logging facilities. In this implementation the constants are initialized based upon the value of the Java System property net.jxta.logging.Logging. This implementation defines all of the public constants as final which enables the JVM/JIT to optimize out the logging code when appropriately configured.

    Alternate implementations of this class could;

    • Initialize the public constants with manifest constants, ie. true or false which would allow the Java compiler to optimize out logging code at compile time.
    • Remove the final qualifier from the constants and provide additional methods to dynamically set the logging configuration at runtime.
    To control logging within applications :
     
    System.setProperty("net.jxta.logging.Logging", "FINEST");
    System.setProperty("net.jxta.level", "FINEST");
    System.setProperty("java.util.logging.config.file", "/home/userhome/logging.properties");

    Sample logging properties :

     
    # default file output is in user's home directory.
    java.util.logging.FileHandler.pattern = %h/java%u.log
    java.util.logging.FileHandler.limit = 50000
    java.util.logging.FileHandler.count = 1
    java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter

    # Limit the message that are printed on the console to INFO and above
    java.util.logging.ConsoleHandler.level = FINEST
    java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

    # Facility specific properties.
    # Provides extra control for each logger.
    #
    # For example, set the net.jxta.impi.pipe.PipeResolver logger to only log SEVERE
    # messages:
    net.jxta.impi.pipe.PipeResolver.level = FINEST

     

  • 相关阅读:
    【洛谷】P1156 垃圾陷阱【DP】
    【洛谷】P1063 能量项链【区间DP】
    Android
    Android
    Android中使用ViewPager制作广告栏效果
    Android UI 设计之 TextView EditText 组件属性方法最详细解析
    GitHub 优秀的 Android 开源项目
    下载 编译 Android源代码 和 Android kernel源代码
    UML建模语言入门 -- 静态图详解 类图 对象图 包图 静态图建模实战
    Android开发技巧--Application, ListView排列,格式化浮点数,string.xml占位符,动态引用图片
  • 原文地址:https://www.cnblogs.com/cuizhf/p/2174590.html
Copyright © 2011-2022 走看看