The example below normal output is: "===start", want to output: after the agency "mylog:===start"
Additional today tried not success, please master under the guidance of the
Package com. Example. The demo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
The import org. Springframework. Boot. SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ SpringBootApplication
Public class DemoApplication {
The static Logger Logger=LoggerFactory. GetLogger (DemoApplication. Class);
Public static void main (String [] args) {
Logger. The info (==="start");
//how through the way of acting, the logger attach a label on the output of the example above is normal output:==="start", want to output: after the agency "mylog:===start"
SpringApplication. Run (DemoApplication. Class, args);
}
}
CodePudding user response:
Logger. The info (" mylog:===start "); Cannot be directly output like this?CodePudding user response:
Didn't know what you mean, log output can be use placeholder, like this, if you wantlogger. The info (" {}===start ", "mylog:");
CodePudding user response:
Sorry, may be I didn't say clear, I'll ThreradLocal China a logo, each time to print the log can be able to transform the logo attached to the message automatically, with a focus on the automatic additional, people don't need to know the specific additional output log operations, into the operation of the similar AOP is understandable, I tried the dynamic proxy, but no success; Do you have no experience in this fieldCodePudding user response:
https://blog.csdn.net/qq_24135155/article/details/106294320, you see if you want to achieve this effect,CodePudding user response:
Rewrite the info method???????CodePudding user response:
Can use template, access to the log message, talking behind the log content as parameters playing joining together