Stanford CoreNLP Server禁用日志记录 [英] Stanford CoreNLP Server disable logging

查看:210
本文介绍了Stanford CoreNLP Server禁用日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得服务器的日志记录非常详尽.有没有一种方法可以禁用或减少日志记录输出?看来,如果我将文档发送到服务器,它将把内容写到stdout,这可能会导致性能下降.

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.

我能以某种方式做到吗?

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.

运行服务器

java -mx6g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -prettyPrint false 2&>1 >/dev/null

其中,>/dev/null会将输出不输出任何内容.不幸的是,这本身并没有帮助. 2&>1似乎可以解决问题.我承认我不知道它实际上在做什么.但是,我比较了两次运行.

where >/dev/null would pipe the output into nothing. Unfortunately this alone did not help. 2&>1 seems to do the trick here. I confess that I do not know what it's actually doing. However, I compared two runs.

运行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 

无需其他参数即可运行

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 

这是一个非常肤浅的测试,但似乎会产生很大的影响.此处的差异是1.828的因数,随时间变化是相当大的.

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.

但是,这只是一个快速测试,我不能保证我的结果是完全理智的!

However, this was just a quick test and I cannot guarantee that my results are completely sane!

进一步更新:

我认为这与JVM如何随着时间优化代码有关,但是每句话的时间可以与我在本地计算机上获得的时间相比.请记住,我使用2&>1 >/dev/null消除了stdout日志记录,得到了以下结果.

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. Keep in mind that I got the results below using 2&>1 >/dev/null to eliminate the stdout logging.

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 . 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. Other logging can then be configured with SLF4J, if it's in your classpath.

这篇关于Stanford CoreNLP Server禁用日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆