I have a question, do you know how can I set the log level by scope (warn, info, error) (prod, stage, develop)? thanks!
@CodeJava4 жыл бұрын
When creating a logger in Java code, you can specify the category name: Logger logger = LoggerFactory.getLogger("prod"); Then in the configuration file: In log4j2 you can use any name of a logger, not just package name.
@germangonzalez7185 Жыл бұрын
Do you have it for gradle? The console works, but it doesn't create the log file or it doesn't write to it, even when i create it.
@CodeJava Жыл бұрын
no, I don't have it for Gradle.
@GiangLe-pv4gt Жыл бұрын
@germangonzalez7185 me too, If you have solved the problem, please help me
@germangonzalez7185 Жыл бұрын
@@GiangLe-pv4gt My problem was how to leave out the the logging started. this is how you do it for gradle in build.gradle: configurations { all*.exclude group:'org.springframework.boot', module:'spring-boot-starter-logging' } also, be careful with the xml file with the appender ref and the root. However in the video this part is explained very well :)
@tuannobi3 жыл бұрын
Thanks a lot. It's helpful. Do u have any video about MDC?
@CodeJava3 жыл бұрын
what is MDC you want to mean?
@tuannobi3 жыл бұрын
@@CodeJava It's ThreadContext in log4j2.. I tried it again and it worked :D
@tuannobi3 жыл бұрын
@@CodeJava Do u have any videos about Layout? logging.apache.org/log4j/2.x/manual/layouts.html
@jeebanpradhan75823 жыл бұрын
I did same thing but I don't know why the fill is not creating on my project. if i do maven install then only I get the file, is there any solution for that.
@sagarsri41434 жыл бұрын
Gud Explanation👌
@CodeJava4 жыл бұрын
Glad it helped.
@rgoers4 жыл бұрын
There is no reason to use the SLF4J API to be "independent" of a logging implementation. You can use the Log4j 2 API for the same purpose. It does not require that the implementation be Log4j 2. The Log4j 2 API has more features - such as support for Lambda expressions and support for logging Messages instead of just Strings - than SLF4J.
@CodeJava4 жыл бұрын
Awesome, thank you very much for your great insights
@spnarayanrao3 жыл бұрын
I want to send an email when error occurs. please check my Root levels, is this correct to specify only error has to been mailed