If you want to create our own custom logs then you have to create a property file under your java web project
1) In Property, the file will look like this one.
#Direct log message to stdout
log4j.rootLogger=INFO, ROOT
log4j.appender.ROOT=org.apache.log4j.RollingFileAppender
# at aws create a directory under /usr/ like "sudo mkdir othogologs" then create a file inside it like dump.log and assign access to this file chmod 777 dump.log
log4j.appender.ROOT.File=/usr/othogologs/dump.log
#log4j.appender.ROOT.File=F:/logs/othogodump.log
log4j.appender.ROOT.MaxFileSize=10240KB
log4j.appender.ROOT.MaxBackupIndex=10
log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
log4j.appender.ROOT.layout.ConversionPattern=[%d] %t %c %-5p - %m%n
log4j.logger.com.xml=INFO
Source : https://www.tecmint.com/empty-delete-file-content-linux/
1) In Property, the file will look like this one.
#Direct log message to stdout
log4j.rootLogger=INFO, ROOT
log4j.appender.ROOT=org.apache.log4j.RollingFileAppender
# at aws create a directory under /usr/ like "sudo mkdir othogologs" then create a file inside it like dump.log and assign access to this file chmod 777 dump.log
log4j.appender.ROOT.File=/usr/othogologs/dump.log
#log4j.appender.ROOT.File=F:/logs/othogodump.log
log4j.appender.ROOT.MaxFileSize=10240KB
log4j.appender.ROOT.MaxBackupIndex=10
log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
log4j.appender.ROOT.layout.ConversionPattern=[%d] %t %c %-5p - %m%n
log4j.logger.com.xml=INFO
First you have to create our own directory inside the home director (Means under directly under / ) so here is usr directory you can create your directory inside the usr directory.
After creating directory inside the create your onemore direcotry so that you can keep your website logs their so i am using you directory name like "domainlogs" under this directory you have create a file like dump.log file and the you have to change premssion for this file
chomd 777 dump.log
How to delete content from a file
1) First, we have to check file size by the following command.
I am here the location of a file and i have a file called dump.log
[root@ip-172-31-31-136 othogologs]# du -sh dump.log
it will show the output like
[root@ip-172-31-31-136 othogologs]# du -sh dump.log
3.9M dump.log
How to delete content from a file
1) First, we have to check file size by the following command.
I am here the location of a file and i have a file called dump.log
[root@ip-172-31-31-136 othogologs]# du -sh dump.log
it will show the output like
[root@ip-172-31-31-136 othogologs]# du -sh dump.log
3.9M dump.log
2) Now empty a file by the following command.
[root@ip-172-31-31-136 othogologs]#
Source : https://www.tecmint.com/empty-delete-file-content-linux/
Comments
Post a Comment