Daniel W.
Daniel W.

Reputation: 103

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.

Upvotes: 0

Views: 1324

Answers (1)

Daniel W.
Daniel W.

Reputation: 103

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

Upvotes: 1

Related Questions