问题描述
我正在从log4j迁移到logback. log4j具有%l格式指定符,该指定符将打印出通话方法的完全限定名称,然后呼叫者来源源于括号之间的文件名和行号.示例:com.my.company.myclass.dosomething(myclass.java:54)
我想要使用记录的相同输出.他们没有指定%l格式.他们确实具有%呼叫者格式指定符,当您提供{0}选项时,您将获得调用堆栈的第一级.示例:caller+0在com.my.company.myclass.dosomething(myclass.java:54)
我不希望前缀"呼叫者+0".有没有办法这样做,而无需创建自己的格式指定符,其中我只需删除字符串的那部分?
推荐答案
尝试编译中的以下命令
javac -g
问题描述
I am migrating to Logback from log4j. Log4j has the %l format specifier which will print out the fully qualified name of the calling method followed by the callers source the file name and line number between parentheses. Example: com.my.company.MyClass.doSomething(MyClass.java:54)
I want the same output using Logback. They don't have the %l format specified. They do have the %caller format specifier and when you provide the {0} option you will get the first level of the call stack. Example: Caller+0 at com.my.company.MyClass.doSomething(MyClass.java:54)
I don't want the prefix "Caller+0 at ". Is there a way to do this without having to create my own format specifier in which I would just remove that part of the string?
推荐答案
try the following command in your compiling
javac -g