我正在使用SLF4j和logback来记录消息。它工作正常并写入配置文件。但是当我构建一个可执行jar并尝试从提示符作为java -jar executableFile运行时。它既没有写入配置文件,也在控制台上显示大量调试消息。
这是我的logback.xml:
SELECT
"Total Program" AS BL
,TOTALS_COB_ALL_TOTALS.AFP_ AS AFP
,TOTALS_COB_ALL_TOTALS.ALLT_ AS ALLT
,TOTALS_COB_ALL_TOTALS.SP_C_ AS SP_C
,TOTALS_COB_ALL_TOTALS.SP_O_ AS SP_O
,TOTALS_COB_ALL_TOTALS.COMMITS_ AS COMMITS
,TOTALS_COB_ALL_TOTALS.OBS_ AS OBS
,TOTALS_COB_ALL_TOTALS.RA_ AS RA
,IIF([SP_C_] = 0, 0, [COMMITS_] / [SP_C_]) AS COM_SP_RATE
,IIF([SP_O_] = 0, 0, [OBS_] / [SP_O_]) AS OBS_SP_RATE
,IIF(Nz([AFP_], 0) = 0, 0, Nz([OBS_], 0) / [AFP_]) AS OB_AFP_RATE
,TOTALS_COB_ALL_TOTALS.UNC_ AS UNC
,TOTALS_COB_ALL_TOTALS.AVL_ AS AVL
,TOTALS_COB_ALL_TOTALS.ACW_ AS ACW
,7999 AS SO
FROM
TOTALS_COB_ALL_TOTALS;
答案 0 :(得分:1)
原因是您的主类没有找到logback.xml,因此logback使用默认的appender - 在这种情况下是控制台。您需要确保在打包jar时,logback.xml位于正确的位置。