How to put the current date in logback filename with yaml? - spring-boot

In springboot, I'm trying to put the current date in my log filename lke this : 2020-01-31-log.log
I tried this :
logging:
level:
root: info
com.inyt.inytcirculationportal: debug
file:
name: "logs/%d-log.log"
but nothing seems to work.

Putting the date in the log file like this does not seem like a good idea to me, even if you were able to inject it somehow in your properties.
What if your application runs several days or months? You would only get a file per day if you restart the application at midnight. If you haven't done so, I'd recommend looking at the Logback RollingFileAppender, which will automatically archive your current log file and start a new one at the interval you configured.
With the date pattern you mentioned, your log folder could look like this:
app.log <- currently active log
app.2020-01-30.log <- yesterday's log
app.2020-01-29.log <- you get the idea ;-)

Related

How to config rsyslog with a filename not static

I need to monitor a log file that rotates every day in the same location. The format of the file is: filename.log.YY-MM-DD
To config rsyslog, I use wildcard to map filename.log.*, but I don't want to review old logs, just the actual day.
I tried to use date command in File parameter but its not recognized. Also with a variable is not recognized.
input(type="imfile"
File="/var/log/filename.log.*"
Tag="logstore""
Severity="info"
Facility="local4")
I expected just log the last filename.log.today, not all filename.log.*

An Error message occurs on command prompt while generating Dashboard from Jmeter

I have started using JMeter 3.1 recently for load testing, all I wanted to do was generate a report dashboard from a csv file.
When I run the following command from Command Prompt:
jmeter -g (csv file location) -o (Destination folder to save HTML Dashboard)
I get the error shown below:
Could not parse timestamp<1.487+12> using format defined by property.saveservice.timestamp+format=ms on sample 1.487+12 .........
I have also attached the screenshot of the error message kindly refer below:
Below is my saveservice properties that I copied into user properties file:
jmeter.save.saveservice.bytes = true
jmeter.save.saveservice.label = true
jmeter.save.saveservice.latency = true
jmeter.save.saveservice.response_code = true
jmeter.save.saveservice.response_message = true
jmeter.save.saveservice.successful = true
jmeter.save.saveservice.thread_counts = true
jmeter.save.saveservice.thread_name = true
jmeter.save.saveservice.time = true
jmeter.save.saveservice.print_field_names=true
# the timestamp format must include the time and should include the date.
# For example the default, which is milliseconds since the epoch:
jmeter.save.saveservice.timestamp_format = ms
# Or the following would also be suitable
#jmeter.save.saveservice.timestamp_format = dd/MM/yyyy HH:mm
#save service assertion
jmeter.save.saveservice.assertion_results_failure_message = true
I am not able to figure out the resaon, any help in this regard will be much appreciated.
please help, also please let me know if any addition information is required.
I have followed the below link to generate Dashboard:
http://jmeter.apache.org/usermanual/generating-dashboard.html
The answer is in your question itself:
Could not parse timestamp<1.487+12>
According to your configuration, JMeter expects first column to be in Unix timestamp format like 1487047932355 (time since beginning of Unix epoch in milliseconds)
Another supported format is yyyy/MM/dd HH:mm:ss.SSS like 2017/02/14 05:52:12.355
So there are several constraints:
The value of jmeter.save.saveservice.timestamp_format = ms should be the same during test execution and dashboard generation
You need to restart JMeter to pick the properties up. For example if you ran the test, then amended properties and then tried to generate dashboard - it might fail
There are no duplicate properties
You don't do anything with the .jtl results file between test execution and dashboard generation
My expectation is that you opened .jtl results file with MS Excel which converted timestamps into scientific notation and saved so most probably you will be able to do the opposite.
Just in case I would also recommend getting familiarised with Apache JMeter Properties Customization Guide
The default timestamp format in JMeter csv and logs is given in a Unix style format , but you can change it .
Go to (jmeterDirectory)/bin .
open jmeter.properties file .
Search for the following :-
jmeter.save.saveservice.timestamp_format
You will find it commented (Start with #) . Uncomment it and restart the Jmeter .
You can update this above property with the format you need

Use multiple env files

I'm wondering if there's a way in Laravel to specify a set of env files to load. My exact problem is I want to add something like a suffix to all my .js and .css resources. Ideally I'd have a suffix like the release date because it would be ok for these files to be cached within the same release but I would like the caches to be invalidated on the next release. However I want to avoid reading, modifying and saving the .env file if possible and would instead prefer to create a new file e.g. .env.rdate which would be generated via a script, e.g.
echo APP_RELEASE_DATE=`date +%s` > env.rdate
or something like this. Is this at all possible or do I have to read/update/write the .env file instead?
Create your .env.rdate file next to .env file.
Put this to your AppServiceProvider boot method:
$dotenv = new \Dotenv\Dotenv(base_path(),'.env.rdate');
$dotenv->overload();
After you can use in your project:
ENV('APP_RELEASE_DATE')

How can we remove the current date from gradle generated .html and .xml file while running JMeter script from build.gradle file?

I am running my JMeter script from build.gradle file. After executing it is generating the html and xml report files with the script name. My problem is that current date is also present with the script name. Please tell me how to remove the current date from output files.
Gradle- gradle-2.4 version and HTML Report Publisher plugin in Jenkins
I'm assuming you're using com.github.kulya/jmeter-gradle-plugin ?
The date is tacked on to testplan name while generating results, which is then used while generating reports. The intention I believe is so that the results are not overwritten each time you run a test. The way it is currently implemented, it isn't configurable.
If you have only one set of result and report per jmx file, You should be able to define a new task though to strip out the date/timestamp from the results and report files.
task stripDateFromReport() {
new File("build/jmeter-report").eachFileMatch(~/.*.[xml|html]/){ file ->
def m = file.getName() =~ /^(.*?)-[0-9]{8}-[0-9]{4}(.*?)$/
file.renameTo(new File(file.getParentFile().getCanonicalPath()+ File.separator + m[0][1] + m[0][2]))
}
}
Note: If you have more than one report with just a different timestamp, this will obviously fail because once the dates are removed the filenames are not unique anymore.

svn:how to get the changed files within specific date?

I want to make a stat via svn,and the input and output like this:
input:svn url,statDate,endDate
output:
person1 20Lines
persion2 30Lines
eg: my.sh http://svn.xxx.com/trunck/xxx/xxx/test.php 2014-12-01 2014-12-10
I use the shell script,and my idea like follows:
1.svn co the whole project
2.get the changed files within a specific date based on the giving url
3.use the command 'svn blame [file url]' get the changed infos by person
but now I don't know how to get the changed files in a directory within a specific date
please give me any ideas,thanks!
You don't want to use svn status, as this only shows if a file has changed in the working copy, whereas you are looking for commit info. You can, however, use
svn log -vq -r {2014-12-01}:{2014-12-10} http://svn.xxx.com/trunck/xxx/xxx/test.php
for your purposes. The -v adds information on the changed paths, the -q suppresses the commit message and only shows the changed paths.
You can then parse this output for the changed paths, user, and revision, and then use svn diff to find out for a given path how many lines were changed by that user in the specified revision.

Resources