我们尝试过滤从一个类生成的日志:
com.websudos.phantom
Run Code Online (Sandbox Code Playgroud)
为了两个目标:
来自应用程序的所有日志都保存在文件中,除了来自该类的日志
该文件中的所有日志都传输到graylog。
我们使用此过滤器通过正则表达式过滤这些日志:
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator>
<matcher>
<Name>parameter</Name>
<regex>Executing query</regex>
</matcher>
<expression>parameter.matches(formattedMessage)</expression>
</evaluator>
<OnMismatch>DENY</OnMismatch>
<OnMatch>ACCEPT</OnMatch>
</filter>
Run Code Online (Sandbox Code Playgroud)
Executing query此类的正则表达式:com.websudos.phantom
我们不接受将此类的级别设置为,OFF因为我们需要将此日志传输到graylog而不是保存在文件中!
有什么解决办法吗?
我们需要解决方案来通过调用bot通过Linux命令发送消息:
python testbot.py "hello authed users:)"
Run Code Online (Sandbox Code Playgroud)
这种方法可行吗?