静音Stanford coreNLP日志记录 [英] Mute Stanford coreNLP logging
问题描述
首先,Java不是我惯用的语言,所以我对它非常基础。我需要将它用于这个特定的项目,所以请耐心等待,如果我遗漏了任何相关信息,请提出要求,我很乐意提供。
First of all, Java is not my usual language, so I'm quite basic at it. I need to use it for this particular project, so please be patient, and if I have omitted any relevant information, please ask for it, I will be happy to provide it.
我已经能够实现coreNLP,并且,似乎已经正常工作,但是产生了许多消息,如:
I have been able to implement coreNLP, and, seemingly, have it working right, but is generating lots of messages like:
ene 20, 2017 10:38:42 AM edu.stanford.nlp.process.PTBLexer next
ADVERTENCIA: Untokenizable: 【 (U+3010, decimal: 12304)
经过一些研究(文档,谷歌,其他线程),我想(对不起,我不知道我是怎么回事可以肯定地说,coreNLP正在我的类路径中找到 slf4j-api.jar
,并通过它进行登录。
After some research (documentation, google, other threads here), I think (sorry, I don't know how I can tell for sure) coreNLP is finding the slf4j-api.jar
in my classpath, and logging through it.
我可以使用JVM的哪些属性来设置将要打印的消息的日志记录级别?
Which properties of the JVM can I use to set logging level of the messages that will be printed out?
此外,其中 .properties
文件我可以设置它们吗? (我已经有一个 commons-logging.properties
,一个 simplelog.properties
和一个 StanfordCoreNLP .properties
在我项目的资源文件夹中设置其他包的属性。)
Also, in which .properties
file I could set them? (I already have a commons-logging.properties
, a simplelog.properties
and a StanfordCoreNLP.properties
in my project's resource folder to set properties for other packages).
推荐答案
Om的答案是好的,但是另外两个可能有用的方法:
Om’s answer is good, but two other possibly useful approaches:
- 如果只是来自令牌器的这些警告令你烦恼,你可以(在代码中)或者在StanfordCoreNLP.properties中)设置一个属性,使它们消失:
props.setProperty(tokenize.options,untokenizable = NoneKeep);
。 - 如果slf4j在类路径上,那么,默认情况下,我们自己的Redwoods记录器确实会记录slf4j。因此,您还可以使用slf4j设置日志记录级别。
这篇关于静音Stanford coreNLP日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!