ERLEDIGT
NEIN
NEIN
ANTWORTEN
2
2
ZUGRIFFE
754
754
EMPFEHLEN
-
Ich möchte bei Log4j bei jedem Programmstart ein neues Logfile erstellen (ein Init-Log sozusagen), das das alte überschreibt oder immer in das gleiche Logfile schreiben und vorher die Daten rauslöschen.
Kann ich das über die Log4j-Properties machen oder muss ich dafür z.B. bei jedem Programmstart die Datei löschen/leeren und dann erst loggen?Hallo Nuray!
-
15.03.10 14:13 #2
Laut Doku sollte Append=true das richtige für dich sein.
FileAppender Options:
Threshold=WARN: Appender will not log any messages with priority lower than the one specified here even if the category's priority is set lower. This is useful to cut down the number of messages, for example, in a file log while displaying all messages on the console.
ImmediateFlush=true: Default is true, meaning log messages are not buffered at all which is what you want almost all the time.
File=mylog.txt: File name to log to. You can use ${some_property_key} (for example, java.home or user.home system properties) to specify the path in front. In fact, all options property keys accept this kind of value.
Append=false: Default is true which means append to the end of the file. false overwrites the file at the start of each program run.
-
Perfekt - danke. Das wars
Hallo Nuray!
Ähnliche Themen
-
Log4j: Pfad zur log4j.xml explizit angeben - DOMConfigurator.configure()
Von Kryptaesthesie im Forum JavaAntworten: 8Letzter Beitrag: 13.02.09, 08:26 -
Neue Datei erstellen
Von Masterclavat im Forum Microsoft WindowsAntworten: 6Letzter Beitrag: 27.01.08, 08:48 -
Text-Datei auslesen um neue Variable zu erstellen
Von sydmak im Forum .NET CaféAntworten: 14Letzter Beitrag: 30.08.07, 15:20 -
Immer neue Datei erstellen
Von dwiist im Forum PHPAntworten: 2Letzter Beitrag: 29.01.04, 13:17 -
bei jedem eintrag neue txt datei erstellen
Von aTa im Forum ASPAntworten: 5Letzter Beitrag: 16.09.03, 09:11





Zitieren
Login




