简体   繁体   中英

Logs not appearing in Graylog

I made an application yesterday and wanted to log the messages in Graylog and for that, I followed the instructions of https://quarkus.io/guides/centralized-log-management , installed a Graylog instance on a remote server and configured my application.

#### Graylog logging
quarkus.log.handler.gelf.enabled=true
quarkus.log.handler.gelf.host=my_remote_server
quarkus.log.handler.gelf.filter-stack-trace=true
quarkus.log.handler.gelf.level=ALL
quarkus.log.handler.gelf.include-full-mdc=true

Here is what the code looks like

@POST
@Produces(TEXT_HTML)
@Consumes(APPLICATION_FORM_URLENCODED)
public TemplateInstance perform(@Form final SearchRequest request) {
    LOGGER.debug(String.format("[%s] Calling search page", applicationName));
    final String requestId = UUID.randomUUID().toString();
    LOGGER.debug(format("{%s]  -> Searching for lawyers with data '%s'", applicationName, requestId, request));
    final Query query = searchQueryBuilder.createSearchHibernateQuery(request);
    List< MedicalDoctor> medicalDoctors = (List< MedicalDoctor>) query.getResultList();
    LOGGER.debug(format("[%s] %s -> Searching for lawyers with data '%s' : count %d -> %s", applicationName, requestId, request, medicalDoctors.size(), medicalDoctors));
    return main().data("medicalDoctors", medicalDoctors).data("request", request);
}

As a logger, I'm using

private static final org.jboss.logging.Logger LOGGER = Logger.getLogger(MenuPages.class);

I have no idea why but in Graylog I can only see the logs from the Quarkus startup and none coming from my application (it is not the only method that is supposed to be logging). I tried to change the log message from DEBUG to INFO but to no avail.

Anybody has a clue what is going on for what I misconfigured somewhere?

Thanks for the help,

D.

Changing the log level to INFO in

quarkus.log.handler.gelf.level=INFO

and using debug.info in the code meaning

LOGGER.info(format("%s]  -> Searching for lawyers with data '%s'", applicationName, requestId, request));

did the trick. Merci Loic

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM