Author |
Message
|
Lucky |
Posted: Mon Jul 08, 2013 11:31 pm Post subject: Logging to a file constraints - WMB8 |
|
|
Apprentice
Joined: 06 Feb 2007 Posts: 35
|
Hi All,
We have a message flow and seperate logging subflow which will write all the incoming msgs to a file. Currently we are appending each message to a single file and new file is created for each day.
We are asked to implement as below:
Write message to file(say file1) until it reach 1MB size. Once file1 reaches 1MB then create new file file2 and write it till 1MB size and this has to go on till we reach file10. After this we need to rewrite the data in file1 after it reaches 1MB, rewrite file2 etc... Something like circular logging into 10 files with file size to be 1MB.
Let me know how this can be implemented using WMB 8.0.0.1. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Jul 09, 2013 12:24 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
What you are asking is remarkably similar to this post
[url]
http://www.mqseries.net/phpBB2/viewtopic.php?t=64725
[/url]
Are you by any chance working on the same project?
BTW, logging to files is so very '1990's'. There are far better ways to log incoming and outgoing data. It is also common practice in Java shops where they seem to use Log4j everywhere.
If you think about it, you could put together a solution that allows you to link the incoming message and the outgoing message. Doing this really helps finding errors in the system. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Tibor |
Posted: Tue Jul 09, 2013 9:48 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
You can use the syslog facility on Unix / Linux platform and in case of that there are some method for setting its behavior, depenpent by the platform and syslog engine.
By the way, if you are familiar in log4j, this is your best, as it was recommended by smdavies99. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Jul 09, 2013 9:58 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jul 09, 2013 10:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
java.util.logging is just as functional as log4j, and requires far less configuration and management from a Broker point of view.
No need to worry about classpaths, classloaders or jar files! |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Jul 09, 2013 10:46 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Tibor wrote: |
By the way, if you are familiar in log4j, this is your best, as it was recommended by smdavies99. |
I did not and never would recommend Log4j. IT has many problems as have been documented here several times. I used it as an example of the sort of thing a Java dev would use and I'm certainly not one of them (like Vitor )
What I was trying to point out is that Logging to files is so old fashioned and frankly there are far better ways to acheive a record of inputs and outputs.
One disadvantage of Log4j is that you are typically writting t oa fairly slow medium. That may slow down overall throughput of your system. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Tibor |
Posted: Tue Jul 09, 2013 11:26 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
smdavies99 wrote: |
One disadvantage of Log4j is that you are typically writting to a fairly slow medium. |
Hmmm, I don't think so writing to a file (in the local filesystem) would be slow, comparing to any other option, e.g. calling an SQL UPDATE, etc. |
|
Back to top |
|
 |
goffinf |
Posted: Tue Jul 09, 2013 1:38 pm Post subject: |
|
|
Chevalier
Joined: 05 Nov 2005 Posts: 401
|
Tibor wrote: |
smdavies99 wrote: |
One disadvantage of Log4j is that you are typically writting to a fairly slow medium. |
Hmmm, I don't think so writing to a file (in the local filesystem) would be slow, comparing to any other option, e.g. calling an SQL UPDATE, etc. |
Especially since you would typically use a buffered asynch appender.
Fraser. |
|
Back to top |
|
 |
|