问题标签 [fileappender]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 使用接收器组件时如何配置rollingPolicy?
我想要一个日志文件,可以在第二天开始时滚动,或者如果它达到指定的文件大小。但是我的日志文件从远程附加程序接收日志记录事件。
我的 log.xml 是:
但是使用上述配置,如果日志文件的大小达到 10 MB,则不会滚动日志文件。所以我想知道滚动策略是否仍在为 ServerSocketReceiver 组件运行。
请帮忙给我建议。
c# - Log4net 有时会创建两份日志,一份为空
使用下面的配置,大约一半的时间,我每一个得到两个日志,一个是空的。它们的文件名相差一秒(log.2015-03-09_11-50-25 vs log.2015-03-09_11-50-26)
我试图每次运行控制台应用程序都有一个日志。
后一个日志是唯一填充/写入的日志。
为什么会这样?我如何解决它?
编辑:原来我在我的代码中实例化了第二个记录器。当实例化发生在另一秒时,会创建第二个日志。appender 工作正常。
configuration - log4net - conversionPattern per level for single FileAppender?
While it is not difficult to setup different log files, each with a different conversionPattern, per level, I would like to have minimal logging for all but errors, where I'd like a detailed log entry. Here's a snippet of my current configuration:
I'd love to have both of these configurations go into a single log file, just have different conversionPatterns for each. Can this be done?
logging - Any examples of a Log4net Rolling Daily file appender sent via email?
This is done inside of a mvc5 application, setting up the file appenders was the easy part. Now I'm stuck as to how to go about setting up a logging such that:
- Daily file logging names are in the format "logfileName-{month}-{day}-{year}.txt" format
- Setting up a daily log file appender such that after 24 hours the log file or log information is sent to a email address.
I'm surprised that I'm having such a hard time finding examples of such a solution. I don't think what I'm doing is revolutionary or unique. Any examples or documentation (especially for the email smtp part) would be greatly appreciated.
And yes I have looked at http://logging.apache.org/log4net/release/config-examples.html
java - 在 log4j fileappender 中未在文件中附加任何日志
我正在为 web 应用程序使用 log4j。我尝试了一个 log4j 的 java 示例,它根据包生成不同的日志文件。但是当我将它应用于 webApplication 文件正在生成但它是空白的。文件中没有显示输出。下面是代码。
grails - 将每个 grails cron 作业的日志保存到单独的文件中
我使用带有 log4j 的 grails 2.2.4 版本。我有 15 个 cron 作业在不同时间运行,有些同时运行。我需要将每个作业的日志保存到单独的日志文件中。
当作业被执行时,我需要获取整个流程的日志。
例子
如何仅在执行 SampleTestOneJob 时获取 SampleTestOneJob 和 UtilService 的日志。
如何仅在执行 SampleTestTwoJob 时获取 SampleTestTwoJob 和 UtilService 的日志。
现在使用 RollingFileAppender 我已经做到了。但问题是 SampleTestOneJob 和 SampleTestTwoJob 何时执行。由于两者都在 UtilService 中调用 findAllAdmins。从 SampleTestOneJob 调用 findAllAdmins 时的日志将在 SampleTestTwoJob 中可用,从 SampleTestTwoJob 调用到 findAllAdmins 时的日志将在 SampleTestOneJob 中可用。
有没有办法识别流程并将流程日志添加到文件中。
配置文件
java - 使用 dropwizard 时为 config.yml “必须指定 maxFileSize”
自从我从dropwizard-core 0.7.1移动到1.0.0后,我一直面临运行时错误,如下所示 -
问题是,即使我对 config.yml 进行了相应的更改并成功编译了项目。仍然在尝试运行该项目时,我遇到了同样的错误。
配置.yml
如果需要,file-size-rolled
定义如下 -
我在这里缺少与版本升级相关的哪些更改?
python - Python重写而不是追加
我有两个 csv 文件 result.csv 和 sample.csv。
结果.csv
样本.csv
我有一个 python 脚本,如果 result.csv 中的行与 sample.csv 中的行中的第一个单词匹配,它将比较两个文件,然后在 sample.csv 中的每一行附加 1 否则附加 0
它应该看起来像 M11435TDS144,STB#1,Router#1,1 和 M11543TH4258,STB#4,Router#1,0 因为在 result.csv 中找不到 M11543TH4258
脚本.py
示例输出(sample.csv)如果我运行脚本两次
每次我运行脚本时,都会将 1 和 0 添加到新列 sample.csv 中。每次我运行脚本时有什么办法,我可以替换附加的列而不是增加列。
java - Log4j:如何在属性文件中创建默认值
我有以下文件附加程序
但是,如果有人忘记设置系统属性,我想确保它仍然正常工作。有没有办法在属性文件中指定默认值?
我不想以任何方式更改 log4j.xml。我只想更改 log4j 属性文件,或者如果可能的话,进行一些代码更改以反映我的需要。
例如,如果可能,我可以检查代码中的系统属性,如果未设置,则将默认值传递给记录器。这可行吗?
nullpointerexception - 文件追加器抛出 java.lang.NullPointerException
我在 ubuntu 14 上运行 kaa 0.10。当我选择 File appender 时,我没有看到任何创建的日志文件。/var/log/kaa 的 kaa 日志有异常:
这是我的文件附加器配置:
我在 kaa 沙箱中尝试了相同的配置,效果很好。但我不能让它在我自己的服务器上工作。
请帮忙。谢谢。
詹姆士