This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Log4j - Splitting a large log content

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We have a requirement to split the large log message (Lets say a xml having lot of data) and logging only at max 4 mb of data at a time.
So if the log is of 6 mb split it into two and log first 4 mb in one log statement and remaining 2 mb in second log statement.
Can anybody please guide me on how to do this?

Any help is appreciated.

Thanks a lot in advance for your time.


Regards,
Ajit
 
Ranch Hand
Posts: 450
1
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to split the log? Are the log files already generated? You must be knowing that you can limit the size of the log file to the size you want and log4j would automatically take care of the size constraint for you.

If you want to split the logs already generated, I do not think log4j would be of much help on that.

Cheers,
Raj.
 
Ajit Kulkarni
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Raj for your time.

Yes, the requirement is to split the log and not the log files.
It is to take care that if someone logs a log of more then say 4MB (Lets say a message received from a MQ, a large XML etc) we should split the log itself.

 
Let nothing stop you! Not even this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!