is it possible to generate log file weekly using RollingFileAppender ? I am able to generate the file daily but would like to generate it weekly as the cron runs weekly twice.
I tried below code but it generates daily log.
log4j.appender.file.name=weeklycronlog
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.maxFileSize=50MB
log4j.appender.file.maxBackupIndex=5
log4j.appender.file.File=${app.root.dir}/logs/application_cron_%d{yyyy-MM-dd}-%i.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%d{dd MMM yyyy HH:mm:ss,SSS}] %5p %c{1}:%L - %m%n
Yes, it is possible to generate log file weekly. Just replace the log4j.appender.file.File by the following value:
log4j.appender.file.File=${app.root.dir}/logs/application_cron_%d{yyyy-ww}-%i.log
For example the file name would be: application_cron_2020_24-xxx.log means 24th week, 2020 year.
For more details you can visit log4j-rolling-file-example
Related
First, I referenced this thread and this documentation, and various articles like this one, but I'm obviously missing something.
I have tried various combinations. What I currently have is
logging:
level.root: trace
file:
name: ${PWD}/logs/spring.log
max-size : 1MB
max-history : 3
total-size-cap : 2MB
pattern:
file : "%d{yyyy-MM-dd HH:mm:ss} %-5level [%thread] [%class{36}] - %msg%n"
console : ${logging.pattern.file}
rolling-file-name : ${PWD}/logs/archive.%i.log
also tried
logging.logback.rollingpolicy:
file-name-pattern : ${PWD}/logs/${spring.application.name}.%i.log
max-file-size : 2MB
With root log level set to TRACE the logs go over 2MB almost immediately.
It works fine when we use a separate XML file to configure logback, but we're trying to remove the need.
This is the best yaml logback configuration that's working for me with lot of difficulties:
logging:
file:
path: /Volumes/Local Disk/logs
name: spring.log
logback:
rollingpolicy:
total-size-cap: 1MB
max-history: 3
max-file-size: 1MB
file-name-pattern: /Volumes/Local Disk/logs/spring.%d{yyyy-MM-dd}.%d{HH:mm:ss.SSS}.%i.log.gz
level:
root: trace
Screenshot:
I am processing some documents and I am getting many WORKDAY messages as seen below.
There's a similar issue posted here for WEEKDAY. Does anyone know how to deal with this message. I am running corenlp in a Java server on Windows and accessing it using Juypyter Notebook and Python code.
[pool-2-thread-2] INFO edu.stanford.nlp.ling.tokensregex.types.Expressions - Unknown variable: WORKDAY
[pool-2-thread-2] INFO edu.stanford.nlp.ling.tokensregex.types.Expressions - Unknown variable: WORKDAY
[pool-2-thread-2] INFO edu.stanford.nlp.ling.tokensregex.types.Expressions - Unknown variable: WORKDAY
[pool-1-thread-7] WARN CoreNLP - java.util.concurrent.ExecutionException: java.lang.RuntimeException: Error making document
This is an error in the current SUTime rules file (and it's actually been there for quite a few versions). If you want to fix it immediately, you can do the following. Or we'll fix it in the next release. These are Unix commands, but the same thing will work elsewhere except for how you refer to and create folders.
Find this line in sutime/english.sutime.txt and delete it. Save the file.
{ (/workday|work day|business hours/) => WORKDAY }
Then move the file to the right location for replacing in the jar file, and then replace it in the jar file. In the root directory of the CoreNLP distribution do the following (assuming you don't already have an edu file/folder in that directory):
mkdir -p edu/stanford/nlp/models/sutime
cp sutime/english.sutime.txt edu/stanford/nlp/models/sutime
jar -uf stanford-corenlp-4.2.0-models.jar edu/stanford/nlp/models/sutime/english.sutime.txt
rm -rf edu
🐞 Bug report ??
image
logging:
level:
com.zaxxer.hikari: DEBUG
org.springframework: INFO
org.kafka.test: TRACE
file: "logs/%d{yyyy-MM-dd HH_mm_ss} pid-${PID}.log"
pattern.console: "%d{HH:mm:ss} - %msg%n"
Hello.
please help with the file name.
The time format does not work well.
I expected to see 1 file named "2020-02-07 10_38_40 pid-17996.log"
I got 2 files and the file names are bad.
Please do not advise using logback-spring.xml
I configure logs through .yml
When I tried to do merge using MergeResults plugin it throws error:
Error parsing field 'timeStamp' at line 1. java.text.ParseException: Unparseable date:"
TWO AggregateReport JTL files successfully converted into csv using the below CMD runner command
JMeterPluginsCMD.bat --generate-csv E:\JMETER\PROJECT_NGP\Results\SL_Rel\Build_165-20749\Reports_09-05-2017-17-07-07\NGP_LoadTest_Results_AgReport.csv --input-jtl E:\JMETER\PROJECT_NGP\Results\SL_Rel\Build_165-20749\Reports_09-05-2017-17-07-07\NGP_LoadTest_Results_AgReport.jtl --plugin-type AggregateReport
Below is the error log details from jmeter.log file
2017-09-06 12:35:40,963 INFO o.a.j.s.CSVSaveService: E:\JMETER\PROJECT_NGP\Results\SL_Rel\Build_165-20749\Reports_09-05-2017-17-07-07\NGP_LoadTest_Results_AgReport.csv does not appear to have a valid header. Using default configuration.
2017-09-06 12:35:40,963 WARN o.a.j.s.CSVSaveService: Error parsing field 'timeStamp' at line 1. java.text.ParseException: Unparseable date: "sampler_label,aggregate_report_count,average,aggregate_report_median,aggregate_report_90%_line,aggregate_report_95%_line,aggregate_report_99%_line,aggregate_report_min,aggregate_report_max,aggregate_report_error%,aggregate_report_rate,aggregate_report_bandwidth,aggregate_report_stddev"
2017-09-06 12:35:40,963 WARN o.a.j.r.ResultCollector: Problem reading JTL file: E:\JMETER\PROJECT_NGP\Results\SL_Rel\Build_165-20749\Reports_09-05-2017-17-07-07\NGP_LoadTest_Results_AgReport.csv
2017-09-06 12:35:40,963 WARN o.a.j.s.CSVSaveService: Unknown column name sampler_label,aggregate_report_count,average,aggregate_report_median,aggregate_report_90%_line,aggregate_report_95%_line,aggregate_report_99%_line,aggregate_report_min,aggregate_report_max,aggregate_report_error%,aggregate_report_rate,aggregate_report_bandwidth,aggregate_report_stddev
In user.properties file and properties file timestamp settings are same(see the below screenshots).
Not able to figured it out what was wrong, Please advise.
JMeter configuration on the machine where you are doing results merge must match configuration of the machine where tests were executed. If there are inconsistencies the majority of JMeter Listeners will fail, neither you will be able to generate HTML Reporting Dashboard
For example I see in your user.properties file the following issues:
You have duplicate jmeter.save.saveservice.timestamp_format property settings defining different timestamp formats
You have jmeter.save.saveservice.default_delimiter property set to \t while your results file is comma-separated
So you need to inspect JMeter's configuration of the machine where you are trying to merge results and make it inline with the machine where you ran the test.
References:
Configuring JMeter
Apache JMeter Properties Customization Guide
With the raw jtl files it's working as expected.
I am having an issue with log4j2's SyslogAppender on Mac (OSX 10.9.2). The default format which log4j2 is sending to syslog is causing the messages to be parsed incorrectly. My configuration:
<Syslog name="Syslog" host="localhost" port="514"
protocol="UDP" format="RFC5424" appName="MyApp" id="log4j2-test"
mdcIncludes="Priority,Logger,Exception,Message" newLine="true">
</Syslog>
When I run:
syslog -F raw
I get the following:
[ASLMessageID 1291756] [Time 1411090836] [TimeNanoSec 0] [Level 6] [PID 4294967295] [UID 4294967294] [GID 4294967294] [ReadGID 80] [Host 1] [Sender 2014-09-19T01] [Facility local0] [Message 40:36.481Z Mario.local MyApp - - - Hello, world!]
The same message without the raw formatting shows up like this:
Sep 19 09:40:36 1 2014-09-19T01[4294967295] <Info>: 40:36.481Z Mario.local MyApp - - - Hello, world!
Based on how the Date String is split between two places, it looks like log4j2 SyslogAppender uses a default format of:
%d <host> <app> - - - %m
And syslog is splitting everything incorrectly. The Sender should not be the first part of the Date String, and the Message should not be the combined rest of the message.
I cannot find a way to change SyslogAppender's format string, as adding a PatternLayout element inside is just ignored. I have also looked into the LoggerFields solution proposed here: log4j2 - Syslog appender and PatternLayout and that only complicates the Message element further without fixing the problem of having the incorrect Sender.
Does anyone know how to adjust log4j2's SyslogAppender so that it sends properly formatted messages to OSX 10.9.2's syslog?
I suggest raising this as a feature request on the log4j2 Jira issue tracker: http://logging.apache.org/log4j/2.x/issue-tracking.html