I also used like this way. At the end of the thread, I expect that the file
will be done and renamed.
I write custom policy which is named EndEventTriggeringPolicy to open file, and
read line by line that file will be done.
If I debug the code, it is OK (beacuse of invocationGate.isTooSoon) . In fact,
i catch the end .
Non debug mode is ,really , embarrassing. Appender wouldn’t be finished :/
Maybe 1 sec later, or 5 sec later ..
The code which I mention ..
“if (this.invocationGate.isTooSoon(now)) {
return false;
}
“
So, thread could be finished but, appender couldnt be finished..
Thanks..
<appender name="SIFT" class="CUSTOM….ShiftingAppender">
<discriminator>
<key>fileLocation</key>
<defaultValue>${user.home}\start.log</defaultValue>
</discriminator>
<sift>
<appender name="FILE-${fileLocation}"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${fileLocation}</file>
<append>false</append>
<encoder>
<pattern>%msg%n</pattern>
</encoder>
<rollingPolicy
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${fileLocation}(%i).xml</fileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>2</MaxIndex>
</rollingPolicy>
<triggeringPolicy
class="com.XXXXXX.EndEventTriggeringPolicy">
</triggeringPolicy>
</appender>
From: logback-user <[email protected]> On Behalf Of haobo liu
Sent: Friday, November 1, 2019 10:09 AM
To: logback users list <[email protected]>
Subject: Re: [logback-user] About FileAppender in Logback
I think triggeringPolicy need with RollingFileAppender. combine your needs
it may be necessary to implement a special implementation of
ch.qos.logback.core.rolling.TriggeringPolicyBase ;)
If there is a good way, please share,nice day
<[email protected]<mailto:[email protected]>> 于2019年11月1日周五 下午2:04写道:
Dear Logback Team;
Have a problem with logback .
Have a logback.xml file find it below. Each thread has a single log file.
However, cant recognize file is done or thread is done with looking the file.
File is not locked or something (tried to lock the file by extending
fileappender but cant succeed) . I don’t would like to write a code to get
content of file which I mean, dont wanna write a some symbol to find out file
is done. I also used, triggeringPolicy cant succeed..
<appender name="SIFT" class="XXXXX.SiftingAppender">
<discriminator>
<key>fileLocation</key>
<defaultValue>${user.home}\start.log</defaultValue>
</discriminator>
<sift>
<appender name="FILE-${fileLocation}"
class="ch.qos.logback.core.FileAppender">
<file>${fileLocation}</file>
<append>false</append>
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
</sift>
</appender>
I just would like to change extension when thread is done .log to .xml, or lock
the file while end of the thread, or move the file end of the thread.
Many many thanks.
Have a nice day,
Hasan Birol
Yazılım Danışmanı - Software Consultant
Yazılım Geliştirme Sistemleri ve Platform Uygulamaları Bölümü - Software
Development Frameworks and Platform Applications
T:
E: [email protected]<mailto:[email protected]>
[http://image.ing.com.tr/EmailBanner/ING_LOGO_89x42px-02.png]<https://www.ing.com.tr>
________________________________
[http://image.ingbank.com.tr/EmailBanner/Greatplacetowork_v2.jpg]<https://www.ing.com.tr/>
Kisiye ozel bu mesaj ve icerigindeki bilgiler gizlidir. ING bu mesajin icerigi
ve ekleri ile ilgili olarak hukuksal hicbir sorumluluk kabul etmez. Yetkili
alicilardan biri degilseniz, bu mesajin herhangi bir sekilde ifsa edilmesi,
kullanilmasi, kopyalanmasi, yayilmasi veya mesajda yeralan hususlarla ilgili
olarak herhangi bir islem yapilmasinin kesinlikle yasak oldugunu bildiririz.
Boyle bir durumda lutfen hemen mesajin gondericisini bilgilendiriniz ve mesaji
sisteminizden siliniz.Internet ortaminda gonderilen e-posta mesajlarindaki hata
ve/veya eksikliklerden veya viruslerden dolayi mesajin gondericisi herhangi bir
sorumluluk kabul etmemektedir. Tesekkur ederiz.
The information contained in this communication may contain confidential or
legally privileged information. ING doesn't accept any legal responsibility for
the contents and attachments of this message. If you are not the intended
recipient you are hereby notified that any disclosure, use, copying,
distribution or taking any action in reliance on the contents of this
information is strictly prohibited. If you have received this communication in
error, please notify the sender immediately by responding to this e-mail and
then delete it from your system. The sender does not accept any liability for
any errors or omissions or any viruses in the context of this message which
arise as a result of internet transmission. Thank you.
_______________________________________________
logback-user mailing list
[email protected]<mailto:[email protected]>
http://mailman.qos.ch/mailman/listinfo/logback-user
Kisiye ozel bu mesaj ve icerigindeki bilgiler gizlidir. ING bu mesajin icerigi
ve ekleri ile ilgili olarak
hukuksal hicbir sorumluluk kabul etmez.Yetkili alicilardan biri degilseniz, bu
mesajin herhangi bir sekilde
ifsa
edilmesi, kullanilmasi, kopyalanmasi,yayilmasi veya mesajda yeralan hususlarla
ilgili olarak herhangi bir
islem
yapilmasinin kesinlikle yasak oldugunu bildiririz.Boyle bir durumda lutfen
hemen mesajin gondericisini
bilgilendiriniz ve mesaji sisteminizden siliniz.Internet ortaminda gonderilen
e-posta mesajlarindaki hata
ve/veya
eksikliklerden veya viruslerden dolayi mesajin gondericisi herhangi bir
sorumluluk kabul
etmemektedir.Tesekkur ederiz.
The information contained in this communication may contain confidential or
legally privileged information.
ING doesn't accept any legal responsibility for the contents and attachments of
this message. If you
are not the intended recipient you are hereby notified that any disclosure,
use, copying, distribution or taking
any action in reliance on the contents of this information is strictly
prohibited. If you have received this
communication in error, please notify the sender immediately by responding to
this e-mail and then delete it
from your system. The sender does not accept any liability for any errors or
omissions or any viruses in the
context of this message which arise as a result of internet transmission. Thank
you.
_______________________________________________
logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user