Log4j should stop logging when the disk is full. #2548
Replies: 2 comments 2 replies
-
Yes, I know of the following method:
Not that I know of.
Not that I know of. |
Beta Was this translation helpful? Give feedback.
-
Recent log events are usually more valuable than old events, so you don't want to stop writing logs after 2 GiB are written, you probably want to delete the old ones. For this there is a standard solution: rolling file appender. You basically need a configuration like this: <RollingFile name="ROLLING"
filePattern="logs/app.%d{yyyy-MM-dd}.%i.log">
<DirectRolloverStrategy maxFiles="4"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="512 M"/>
</Policies>
</RollingFile> This way you'll get the most recent 2 GiB of logs per day. Remark: I don't how big your system is, but if you are getting 2 GiB of logs per day, you are probably logging too much.
|
Beta Was this translation helpful? Give feedback.
-
Hi,
Greetings!
Can we stop Log4j to log any event when the disk is about to full?
Is there any configuration in Log4J which can do this?
Is there any way we can have the above mentioned behavior?
is there a way if we can have per day log file size limit? for example per day limit is set 2GB then after 2GB it should not log the events in log file.
Thanks in Advance,
Rupesh
Beta Was this translation helpful? Give feedback.
All reactions