How to set log level to debug?
aamielsan opened this issue · 2 comments
aamielsan commented
I'm fairly new with logging with Java, and is using the out of the box configuration:
<configuration>
<appender name="awslambda" class="org.jlib.cloud.aws.lambda.logback.AwsLambdaAppender">
<encoder type="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] <%-36X{AWSRequestId:-request-id-not-set-by-lambda-runtime}> %-5level %logger{10} - %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="awslambda" />
</root>
</configuration>
I want to change the log level to DEBUG, and tried changing root level to DEBUG:
<root level="DEBUG">
<appender-ref ref="awslambda" />
</root>
It enabled the debug logs for AWS SDK's and not for my loggers:
import org.slf4j.LoggerFactory
class Foo() {
private val logger = LoggerFactory.getLogger(Foo::class.java)
}
How can I resolve this? Also, how can I prevent having a DEBUG log level to AWS SDKs?
igorakkerman commented
Hi @aamiel16,
you can try putting your class into a package, e.g. com.example, then, all you need is:
<configuration>
...
<logger name="com.example" level="INFO" />
<root level="INFO">
<appender-ref ref="awslambda" />
</root>
...
</configuration>You can find all details in the Logback documentation: http://logback.qos.ch/manual/configuration.html
Please let me know if it worked for you.
aamielsan commented
Thanks! That worked flawlessly! Closing this now :)