在Weblogic中,如果我想通过多种轮换类型保存日志文件,那可能吗? 我想制作最大尺寸为5Mb的日志,但是如果它们没有达到我想要的最大尺寸,那么它将在白天旋转。 这可能吗?
<log>
<file-name>logs/examplesServer.log</file-name>
<rotation-type>byTime</rotation-type>
<number-of-files-limited>true</number-of-files-limited>
<file-time-span>24</file-time-span>
<rotation-time>00:00</rotation-time>
<rotate-log-on-startup>true</rotate-log-on-startup>
<logger-severity>Info</logger-severity>
<log-file-severity>Debug</log-file-severity>
<stdout-severity>Notice</stdout-severity>
<domain-log-broadcast-severity>Notice</domain-log-broadcast-severity>
<memory-buffer-severity>Trace</memory-buffer-severity>
<log4j-logging-enabled>false</log4j-logging-enabled>
<redirect-stdout-to-server-log-enabled>false</redirect-stdout-to-server-log-enabled>
<domain-log-broadcaster-buffer-size>1</domain-log-broadcaster-buffer-size>
</log>
答案 0 :(得分:2)
默认情况下 - 否 - 您不能使用这两种类型的日志记录。
设置尺寸限制Requires that you specify a file rotation type of Size.
设置轮换间隔Requires that you specify a file rotation type of TIME.
但是,如果您正在运行自己的应用程序/部署,则可以执行类似创建自己的log4j appender来处理它的操作。参见:
How do you get log4j to roll files based on date and size?
What is the configuration in log4j.xml for rotating the logs based on time as well as size
答案 1 :(得分:1)
WebLogic无法做到这两点,但我在过去使用了Linux / Uix实用程序logrotate来将stdout重定向到文件...
/domains/soa_domain/servers/osb_server/logs/osb_server.out {
missingok
size 48M
copytruncate
rotate 8
}
...所以每天添加&#39;指令和关闭域中的日志轮换(并明显引用服务器日志文件!),应该执行您之后的操作。如果您的域名在Windows上运行,这将无济于事。