Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java日志记录在相同设置上不一致_Java_Logging_Glassfish_Java.util.logging - Fatal编程技术网

java日志记录在相同设置上不一致

java日志记录在相同设置上不一致,java,logging,glassfish,java.util.logging,Java,Logging,Glassfish,Java.util.logging,我有两条玻璃鱼。“GFnb”从Netbean开始进行开发和测试。“GF”从Windows服务开始,用于实际生产运行。正因为如此,我总是确保两种设置都是相同的,至少我已经尽力了。它们的工作原理与预期相同,即,使用库存日志设置时,两者都记录相同的日志。最近,我尝试更改日志的格式,发现我的日志设置在“GFnb”上有效,但在“GF”上无效。我在下面发布了适用于两个系统的设置。请告知我是否遗漏了其他日志设置 我的典型日志编码: import java.util.logging.Logger; static

我有两条玻璃鱼。“GFnb”从Netbean开始进行开发和测试。“GF”从Windows服务开始,用于实际生产运行。正因为如此,我总是确保两种设置都是相同的,至少我已经尽力了。它们的工作原理与预期相同,即,使用库存日志设置时,两者都记录相同的日志。最近,我尝试更改日志的格式,发现我的日志设置在“GFnb”上有效,但在“GF”上无效。我在下面发布了适用于两个系统的设置。请告知我是否遗漏了其他日志设置

我的典型日志编码:

import java.util.logging.Logger;
static final Logger log = Logger.getLogger("mylog");
log.info("processing abc");
My domain.xml以及其他JVM选项:

    <jvm-options>-Djava.util.logging.SimpleFormatter.format=%1$tF %1$tT.%1$tL|%4$s|%3$s|%5$s|%6$s%n</jvm-options>
“GFnb”domain1/config中myapp0_0.log的前几行:

2015-09-23 15:06:38.560|INFO|javax.enterprise.logging|Running GlassFish Version: GlassFish Server Open Source Edition  4.0  (build 89)|
2015-09-23 15:06:38.560|INFO|javax.enterprise.logging|Server log file is using Formatter class: com.sun.enterprise.server.logging.UniformLogFormatter|
2015-09-23 15:06:38.672|INFO|javax.enterprise.system.core.security.com.sun.enterprise.security.auth.realm|SEC1115: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.|
2015-09-23 15:06:38.672|INFO|javax.enterprise.system.core.security.com.sun.enterprise.security.auth.realm|SEC1115: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.|
2015-09-23 15:06:38.672|INFO|javax.enterprise.system.core.security.com.sun.enterprise.security.auth.realm|SEC1115: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.|
2015-09-23 15:06:39.048|INFO|javax.enterprise.system.core|Grizzly Framework 2.3.1 started in: 62ms - bound to [/0.0.0.0:8,080]|
.....
“GF”domain1/config中myapp0_0.log的前几行(所有行都相同):

编辑:我进一步测试了我的设置,发现在GFnb机器上,如果我将GFnb作为Windows服务启动,它与GF存在相同的问题。如果我通过Netbean启动,它没有问题


@杰梅伦斯,谢谢你的回复。我无法从链接中获得想法。我的设置是有效的,除了它不是格式化msg,而是“echo”格式字符串。如果我在JVM选项中更改.format,它确实会更改输出,但仍然没有消息内容。

相关:根据启动器的设置方式,您可能必须使用或删除格式字符串周围的双引号来处理空白。
2015-09-23 15:06:38.560|INFO|javax.enterprise.logging|Running GlassFish Version: GlassFish Server Open Source Edition  4.0  (build 89)|
2015-09-23 15:06:38.560|INFO|javax.enterprise.logging|Server log file is using Formatter class: com.sun.enterprise.server.logging.UniformLogFormatter|
2015-09-23 15:06:38.672|INFO|javax.enterprise.system.core.security.com.sun.enterprise.security.auth.realm|SEC1115: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.|
2015-09-23 15:06:38.672|INFO|javax.enterprise.system.core.security.com.sun.enterprise.security.auth.realm|SEC1115: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.|
2015-09-23 15:06:38.672|INFO|javax.enterprise.system.core.security.com.sun.enterprise.security.auth.realm|SEC1115: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.|
2015-09-23 15:06:39.048|INFO|javax.enterprise.system.core|Grizzly Framework 2.3.1 started in: 62ms - bound to [/0.0.0.0:8,080]|
.....
${1$tF }1$tT.${1$tL|}4$s|${3$s|}5$s|${6$s}n${1$tF 1$tT.${1$tL|}4$s|${3$s|}5$s|${6$s}n