Spring boot logging file name - spring

🐞 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

Related

YAML based log rolling in spring 2.6.7 not triggering

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:

MergeResults plugin throws Error parsing field 'timeStamp' at line 1. java.text.ParseException: Unparseable date:

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.

Exception renaming remote file using Camel FTP

I have a polling route for FTP like this
from("sftp://sftpUsername#ftpServer/path/to/folder?password=sftpPassword
&delay=60000&stepwise=false&move=/home/username/processed/$simple{date:now:yyyy}
/$simple{date:now:MM}/$simple{date:now:dd}/${file:name}&binary=true")
.to("file:///tmp/")
The polling is working as expected. I was able to move the processed files to a sub folder inside the /path/to/folder. However, when I tried to move it to a different folder location. I'm getting an exception. Unfortunately, the exception is not detailed.
DEBUG org.apache.camel.component.file.GenericFileOnCompletion - Done processing file: RemoteFile[/path/to/folder/fileName.zip] using exchange: Exchange[fileName.zip]
DEBUG org.apache.camel.component.file.remote.FtpOperations - Deleting file: /home/username/processed/2017/07/11/fileName.zip
TRACE org.apache.camel.component.file.remote.FtpOperations - Client deleteFile: /home/username/processed/2017/07/11/fileName.zip
TRACE org.apache.camel.component.file.remote.FtpOperations - buildDirectory(/home/username/processed/2017/07/11)
TRACE org.apache.camel.component.file.remote.FtpOperations - changeCurrentDirectory(/home/username)
TRACE org.apache.camel.component.file.remote.FtpOperations - Changing directory: /home/username
DEBUG org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy - Renaming file: RemoteFile[/path/to/folder/fileName.zip] to: RemoteFile[/home/username/processed/2017/07/11/fileName.zip]
DEBUG org.apache.camel.component.file.remote.FtpOperations - Renaming file: /path/to/folder/fileName.zip to: /home/username/processed/2017/07/11/fileName.zip
WARN org.apache.camel.component.file.GenericFileOnCompletion - Error during commit. Exchange[fileName.zip]. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot rename file: RemoteFile[/path/to/folder/fileName.zip] to: RemoteFile[//home/username/processed/2017/07/11/fileName.zip]]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot rename file: RemoteFile[/path/to/folder/fileName.zip] to: RemoteFile[/home/username/processed/2017/07/11/fileName.zip]
at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:115)
I'm using Camel-FTP 2.13.4 which uses commons.net-3.3.jar. I could see that it is trying to do RNFR and RNTO command. I was not able to use those command from command line FTP protocol.
If I understand correctly we can use absolute paths in 2.13.4 version. Please let me know, if this understanding is incorrect.
Thanks in advance for any help in the right direction.
This didn't work as the partition is different and we cannot move a file between partitions. The option is to either move the file to a location in the same partition. Or you could manually FTP it back to a location on different partition.

Spring Boot: Log to multiple files. All DEBUGs to debug.log, all INFOs to info.log

I'm using logging provided by Spring Boot in an application.yml like this:
logging:
file: log/info.log
level.com.mycompany.app: INFO
What I actually want is:
1) Log every DEBUG message from our application (com.mycompany.app) to debug.log,
(optional: every INFO message from the whole app / ROOT to debug.log, too)
2) log every INFO message from the whole app / ROOT to info.log
So in pseudo code, it should look like this:
logging:
level: DEBUG
file: debug.log
com.mycompany.app: DEBUG
level:
ROOT: INFO
file: debug.log
level:
ROOT: INFO
file: info.log
How can I achieve this? Please note, we're using SLF4j, not logback (I've read in other threads about logback for writing to multiple files).
Regards,
Bernhard

How can I disable console messages when running maven commands?

I'm in the process of executing Maven commands to run tests in the console (MacOSX). Recently, development efforts have produced extraneous messages in the console (info, debug, warning, etc.) I'd like to know how to remove messages like this:
INFO c.c.m.s.c.p.ApplicationProperties - Loading application properties from: app-config/shiro.properties
I've used this code to remove messages from the dbunit tests:
ch.qos.logback.classic.Logger Logger = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger("org.dbunit");
Logger.setLevel(Level. ERROR);
However, I'm unsure how to disable these additional (often verbose and irritating) messages from showing up on the console so that I can see the output more easily. Additional messages appear as above and these:
DEBUG c.c.m.s.c.f.dao.AbstractDBDAO - Adding filters to the Main Search query.
WARN c.c.m.s.c.p.JNDIConfigurationProperties - Unable to find JNDI value for name: xxxxx
INFO c.c.m.a.t.d.DatabaseTestFixture - * executing sql: xxxxx
The successful answer was:
SOLUTION: Solution to issue IS adding a 'logback-test.xml' file to the root of my test folder. I used the default contents (as instructed by the documentation - thanks #Charlie). Once file exists there, FIXED!

Resources