0

The default format for Util.Log is

[date] level - module - : message

So something like

[2025-03-04 08:29:28] INFO  - main - : Crypt  : dc7e84bfda79164b7ecd8486985d3860

I'd like to change

  1. the level from say INFO to I and ERROR to E
  2. record the time without the date
  3. change the - to comma

So something like

08:29:28 I,main,Crypt  : dc7e84bfda79164b7ecd8486985d3860

My configuration properties file is the default one I found in samples.

# Configuration for log4j
log4j.rootCategory=DEBUG,console,result,test

log4j.appender.result=File
log4j.appender.result.File=result.log

log4j.appender.test=syslog
log4j.appender.test.level=ERROR

log4j.appender.console=Console
log4j.appender.console.level=WARN
log4j.appender.console.layout=level-message

# Logger configuration
log4j.logger.log=DEBUG
log4j.logger.log.util=DEBUG

log4j.logger.Util.Properties=WARN
log4j.logger.Util=DEBUG
log4j.logger.Util.Log=WARN

I can't find a document that describes the layout or formatter for this configuration file. I've looked at Ada documents and Java documents. I've found documents that describe all the fields that are present but nothing about the formatter.

Is there a link to a document that describes how to set up the formatter?

3
  • 1
    (1) log4j.appender.console.layout.ConversionPattern=%-1p %c{1}:%L,%m%n (2) log4j.appender.result.layout.ConversionPattern=%-1p %c{1}:%L,%m%n (3) log4j.appender.test.layout.ConversionPattern=%-1p %c{1}:%L,%m%n Commented Mar 4 at 9:48
  • @life888888 which version of utilada does this work on? It doesn't change the log output on 2.6.0. Commented Mar 4 at 11:56
  • Code for version 2.8.0 looks the same as code for version 2.6.0. It doesn't support ConversionPattern. Commented Mar 5 at 12:05

1 Answer 1

0

Having had a look at utilada_2.6.0../src/base/log/util-log-appenders.adb, it looks like the formats are fixed. The layout is in the following line.

log4j.appender.console.layout=<layout>

where <layout> can be

  • message
  • level-message (level: message)
  • date-level-message ([date time] level: message)
  • level-date-message ([date time] level: message)
  • if not one of the above then the layout is set to FULL ([date time] level - logger - message)

Looks like if I wish to change to log format, I will have to override some of the functions in util-log-appenders.

Edit

The code is the same on utilada 2.8.0.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.