Skip to main content

How to Create Our Custom Logs for Tomcat Server On EC2 Instance.

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


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

2) Now empty a file by the following command. 
[root@ip-172-31-31-136 othogologs]# 


# : > access.log
OR 
# true > access.log


Source : https://www.tecmint.com/empty-delete-file-content-linux/

Comments

Popular posts from this blog

Android & iOS Application Development For Dummies

App Development ProcessApp Development Process explained in the most simplified way This tutorial will guide all the beginners how an app is developed from scratch and will help in letting the beginners know how the process works.Phase-1 (Conceptualization): Even a concept or an idea starts with an approach to introduce something after acknowledging the inkling of amiss or what's missing in the existing market. Developing the aftermath ideas involves critical questioning and rational thinking towards the wire-framing stage. Phase-2 (Design): After analyzing the idea thoroughly and looking through all possible dimensions, comes the design part, where a feasible layout of the model is planned to move ahead for the further development processes. Phase-3 (Coding): Development process begins with designing a user-friendly UI. Prototypes of the model are prepared with the combined agreement of developers and designers to increase the efficiency and capitalization. The expedience checking r…

Amazon EC2 Server Setup & Installing JDK 8 and Tomcat 8, Running on Port 80 & 443 and Redirect Request from port 80 to 8080 and 443 to 8443

Amazon EC2 Server Setup & Installing JDK 8 and Tomcat 8, Running on Port 80 & 443 and Redirect Request from port 80 to 8080 and 443 to 8443.Step 1 : Log in to youraws account by following this link then click on my account and choose option aws management console.
Note: I am assuming you created your account with aws and you are ready with you account if you haven’t done then you can check out on google you will get many and it's a straight forward steps if you have still problem while creating an account you can comment in comment box i will also provide tutorial for that.
Once you logged in aws management console you are able to see window like this one


Note : Before we go ahead we have to select proper reason from right and side.I choose ohio region for this example.
Step 2 : Now you have to choose EC2 Server from Services tab on left side top corner then choose EC2 Services from “Compute option”

You will get window like this one and right now i have one instance is running for…
Why Do We Need Social Media Marketing For Our Business.
A long time ago when businesses wanted the market to expose their products or service to the public, the most viable options were print marketing or television and radio advertising. Websites were slowly started establishing their way into the mainstream for business, and people were without hesitantly boarding the internet train one-by-one. Fast forward to 2017 and the ways in which businesses can market to their customers have changed very tremendously! Websites for businesses are now more than mainstream, they’ve become a necessity for business purpose. Millions of customers were using search engines to find everything they need to know about a business before even making a purchase. Videos were the new shiny attention-getters and anyone who has a Twitter or Facebook account to keep up with their friends, acquaintances, and near and dear ones.
With all of these rapidly-made new advancements in technology, has opened a door not on…