[英]Stanford CoreNLP Server disable logging
I have the feeling that the logging of the server is quite exhaustive.我感觉服务器的日志记录非常详尽。 Is there a way to disable or reduce the logging output?
有没有办法禁用或减少日志输出? It seems that if I send a document to the server it will write the content to
stdout
which might be a performance killer.似乎如果我将文档发送到服务器,它会将内容写入
stdout
,这可能是性能杀手。
Can I do that somehow?我能以某种方式做到这一点吗?
I found a way to suppress the output from the server.我找到了一种抑制服务器输出的方法。 Still my question is how and if I can do this using a command line argument for the actual server.
我的问题仍然是如何以及是否可以使用实际服务器的命令行参数来执行此操作。 However for a dirty workaround it seems the following can ease the overhead.
但是,对于肮脏的解决方法,以下似乎可以减轻开销。
Running the server with运行服务器
java -mx6g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -prettyPrint false 2&>1 >/dev/null
where >/dev/null
would pipe the output into nothing.其中
>/dev/null
会将输出管道化为>/dev/null
。 Unfortunately this alone did not help.不幸的是,仅此一项并没有帮助。
2&>1
seems to do the trick here. 2&>1
在这里似乎可以解决问题。 I confess that I do not know what it's actually doing.我承认我不知道它实际上在做什么。 However, I compared two runs.
但是,我比较了两次运行。
Running with 2&>1 >/dev/null使用 2&>1 >/dev/null 运行
Processed 100 sentences
Overall time: 2.1797 sec
Time per sentence: 0.0218 sec
Processed 200 sentences
Overall time: 6.5694 sec
Time per sentence: 0.0328 sec
...
Processed 1300 sentences
Overall time: 30.482 sec
Time per sentence: 0.0234 sec
Processed 1400 sentences
Overall time: 32.848 sec
Time per sentence: 0.0235 sec
Processed 1500 sentences
Overall time: 35.0417 sec
Time per sentence: 0.0234 sec
Running without additional arguments不带附加参数运行
ParagraphVectorTrainer - Epoch 1 of 6
Processed 100 sentences
Overall time: 2.9826 sec
Time per sentence: 0.0298 sec
Processed 200 sentences
Overall time: 5.5169 sec
Time per sentence: 0.0276 sec
...
Processed 1300 sentences
Overall time: 54.256 sec
Time per sentence: 0.0417 sec
Processed 1400 sentences
Overall time: 59.4675 sec
Time per sentence: 0.0425 sec
Processed 1500 sentences
Overall time: 64.0688 sec
Time per sentence: 0.0427 sec
This was a very shallow test but it appears that this can have quite an impact.这是一个非常浅的测试,但似乎这会产生相当大的影响。 The difference here is a factor of 1.828 which is quite a difference over time.
这里的差异是一个因子 1.828,随着时间的推移,这是一个很大的差异。
However, this was just a quick test and I cannot guarantee that my results are completely sane!然而,这只是一个快速测试,我不能保证我的结果是完全正常的!
Further update:进一步更新:
I assume that this has to do with how the JVM is optimizing the code over time but the time per sentence becomes compareable with the one I am having on my local machine.我认为这与 JVM 如何随着时间的推移优化代码有关,但每个句子的时间与我在本地机器上的时间相当。 Keep in mind that I got the results below using
2&>1 >/dev/null
to eliminate the stdout
logging.请记住,我使用
2&>1 >/dev/null
消除了stdout
日志,得到了以下结果。
Processed 68500 sentences
Overall time: 806.644 sec
Time per sentence: 0.0118 sec
Processed 68600 sentences
Overall time: 808.2679 sec
Time per sentence: 0.0118 sec
Processed 68700 sentences
Overall time: 809.9669 sec
Time per sentence: 0.0118 sec
You're now the third person that's asked for this :) -- Preventing Stanford Core NLP Server from outputting the text it receives .你现在是第三个被要求这样做的人 :) - 阻止斯坦福核心 NLP 服务器输出它收到的文本。 In the HEAD of the GitHub repo, and in versions 3.6.1 onwards, there's a
-quiet
flag that prevents the server from outputting the text it receives.在 GitHub 存储库的 HEAD 以及 3.6.1 版本之后,有一个
-quiet
标志可防止服务器输出它接收到的文本。 Other logging can then be configured with SLF4J, if it's in your classpath.然后可以使用 SLF4J 配置其他日志记录,如果它在您的类路径中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.