1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[JBoss] How to use identity attribute of io.quarkus.scheduler.Scheduled in log messages

Discussão em 'StackOverflow' iniciado por Stack, Novembro 21, 2025.

  1. Stack

    Stack Membro Participativo

    I have a Java Quarkus application which is using JBoss for logging.

    I am using a scheduled job via io.quarkus.scheduler.Scheduled like so:

    private static final Logger LOGGER = Logger.getLogger(ReportFetchTask.class);

    ...

    @Scheduled(every = "1h", identity = "test", concurrentExecution = SKIP)
    public void fetchData() {
    LOGGER.info("Fetching data...");
    }


    The Quarkus docs https://quarkus.io/guides/scheduler-reference#identity mention that the identity field is used in log messages, but it does not appear.

    I tried adapting the log format to quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{3.}] (%t) [identity:%X{identity}] %s%e%n assuming that the identity might be added to the MDC (https://quarkus.io/guides/logging#use-mdc-to-add-contextual-log-information), but that does not seem to be the case:
    2025-11-17 17:02:25,004 INFO [x.x.x.x] (vert.x-worker-thread-1) [identity:] Fetching data...

    How can I let the identity show up in the log message? The documentation made it seem like this would happen automatically but I couldn't find anything on how to set this up. I guess I could add it manually via the MDC myself, but then what is the purpose of the identity field?

    I also have logs that aren't made in scheduled tasks, so for those logs ideally the identity field would not show up at all.

    Continue reading...

Compartilhe esta Página