Skip to content
Martin edited this page Dec 25, 2021 · 2 revisions

This is a very brief replacement for Apache Log4j.

This framework has been developed for use by the JavaPOS-SPF framework, but can be used for any framework that needs a logging ability. It is based on the java.util.logging framework and has been implemented to easily replace Apache log4j version 1.x which is not a current version. However, there are a lot of restrictions:

  • The only implemented classes are Appender, DailyRollingFileAppender, FileAppender, Layout, Level, Logger, PatternLayout and SimpleLayout.
  • Only Logger methods are getLogger, setLevel, removeAllAppenders, addAppender and log.
  • Only one Appender per Logger object.
  • SimpleLayout implements the following layout: "YYYY-MM-dd kk:mm:ss,SSS LogLevel [ThreadName]: LoggerName: Message".
  • There are the following restrictions for PatternLayout patters:
  • Only allowed modifiers have the format [-]n, where n is a maximum three-digit number.
  • Only allowed conversions are d [date format], m [message], n [line separator], p [priority] and t [thread name].
  • Only one date format specifier is allowed.
  • Format specifier (sequence following the conversion character, enclosed with {}) only allowed for date conversion.
  • Existing log files will be always appended.
  • DailyRollingFileAppender use the pattern given on creation to create the file path postfix for each log. Therefore, the log files have only the correct date and time information within their name and need not to be renamed when rolling occurs.
  • Path names generated by FileAppender and DailyRollingFileAppender will be used as FileHandler pattern string. FileHandler rules for such pattern may generate unexpected side effects.

Clone this wiki locally