Where is my New Relic logs coming from? (LogBack)

Good Day,
I am using the new relic Java agent (7.7.0) to forward my logs to NR. I am trying to override the logging pattern that is currently shown in NR but seems like I’m unable to do so.
In an attempt to see which Appender new relic is using via the java-agent, I’ve disabled logging on the logback.xml file, yet NR is still logging for this service on the platform.

Where is the logs coming from?
NB: Please note I am not trying to disable logging - I know this can be achieved by config on the newrelic.yml file, but disabling any logging on the logback.xml file to identify which appender NR is using by default?

Logback file:

    <?xml version="1.0" encoding="UTF-8"?>
        <configuration>
          <!-- <include resource="org/springframework/boot/logging/logback/defaults.xml"/> -->
          <!-- <include resource="org/springframework/boot/logging/logback/console-appender.xml"/> -->
        </configuration>

Can you please assist?

As you can see, no logs on the console: (Which is what I want)


Yet, NR is still logging:

The agent’s log forwarding feature instruments the logging framework on the Logger and adds the message to a pool regardless of appender configuration.
So to prevent the messages from being sent, you’d have to disable logging at the Logger
by changing the log level for that Logger.

To have more control over the messages you can use the Manual logs in context option.

@aonuki noted, thank you.

Does that mean the log messages the agent sends to NR cannot be formatted / changed / decorated?
I wanted to create an appender that has the following pattern, but it only applies it to the console and not the logs on NR.
Pattern

Is there a different way to another way to achieve this?

There is no way to change the captured logs by configuring the Appender since the logs in the agent are captured on the Logger, before it is sent to the Appender.

Currently there is no way to format the captured logs.

We have this feature in our backlog Add Marker data as attributes on LogEvents.
While it would not allow you to change/format the message, it would allow for more information to be sent with the log.

1 Like

@aonuki thank you!
The feature should be able to solve the problem I am facing.

1 Like