冷面閻羅

          低調做人&&高調做事
          隨筆 - 208, 文章 - 3, 評論 - 593, 引用 - 0

          導航

          文章檔案

          最新評論

          log4j2me 開源的j2me日志工具

          log4j2me is log4j for j2me platform. It is an open source contribution from Witmate.

          It is compatible with Log4J and executable on J2ME platform. When your code move to J2SE/J2EE platform, you need NOT change your code, just replace log4j2me.jar with standard log4j jar file.

           

          Contact us about log4j2me by log4j2me@witmate.com

           

           

           

           

           

           

           

                  

          Differentiations with original log4j

          Limits by j2me platform:

           

          1. j2me can't write to file. So can't set file name directly in FileAppender
          2. j2me can't read file. So can't read configuration from file directly in PropertyConfigurator. But it is possible to get configuration from JAD file.
          3. j2me only can print stack track into standard error output. So can't get stack in LoggingEvent, LocationInfo
          4. J2ME has not java.text package, so %d parameter just use log4j date formatters.
          5. LEVEL_CONVERTER does not work in PatternParser
          6. MESSAGE_CONVERTER(RenderMessage) does not work in PatternParser
          7. Fully qualified name of the calling category class (fqnOfCategoryClass) is same as category name in LoggingEvent.
          8. These parameters of pattern do not work: %X, %F, %M, %L, %l, and log out a question mark.

          Extensions for j2me platform

          1. Configure by JAD file
          2. j2me can't get property list, so a "log4j.categories" property key to list all category names is added into configuration properties. Separator is comma, e.g., log4j.categories: classA,classB
          3. line.separator system property does not exist in J2ME default, LINE_SEP of log4j2me is LF(13) in Layout. It is configurable with LINE_SEP and LINE_SEP_LEN parameetr in Layout
          4. MIDLet form appender: Output log to a MIDLet form.
            • New form appender is log4j2me.util.FormAppender.
            • Optional handler of this appender is Title, this title is MIDLet form title.
            • Configure example

                        log4j.appender.LOGFORM = log4j2me.util.FormAppender         
                        log4j.appender.LOGFORM.Title = mylog4j2me

                           

          Test cases in source code

          • log4j2me.test.Hello.java is a java application test case of configuring log4j2me by code.
          • log4j2me.test.midlets.MHello.java is a midlet test case for j2me platform and configuring log4j2me by example JAD file.

          Downloads

              log4j2me.jar  or Witmate with log4j2me

              Source Code of log4j2me

              JDA example file for MHello test case

          posted on 2008-01-15 09:03 冷面閻羅 閱讀(1306) 評論(0)  編輯  收藏 所屬分類: j2me


          只有注冊用戶登錄后才能發(fā)表評論。


          網站導航:
           
          主站蜘蛛池模板: 庆阳市| 来宾市| 卢氏县| 伊宁县| 滦平县| 监利县| 苏尼特右旗| 潞城市| 阳谷县| 桓台县| 涞源县| 安达市| 曲靖市| 榆林市| 班玛县| 原平市| 榆树市| 翼城县| 霍林郭勒市| 滕州市| 余庆县| 保康县| 广元市| 莱西市| 安吉县| 广昌县| 长乐市| 和林格尔县| 右玉县| 滦南县| 都匀市| 洞口县| 二连浩特市| 南木林县| 友谊县| 陵水| 吉水县| 岚皋县| 石河子市| 宁明县| 乐山市|