On 10 April 2012 12:27, Michael Erskine wrote:
> I know this might sound daft but is your class actually trying to log
> anything?
OK, I see where you're coming from:
http://hc.apache.org/httpcomponents-client-ga/logging.html
...and you would expect the HttpClient to log to the c
I know this might sound daft but is your class actually trying to log anything?
-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org
Rather than your log file processor removing items from a log file,
have _it_ log the items that it _has_ re-indexed!
-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-
27;t suggest anything more than that without
doing your job for you :)
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org
ity. That is what happened. Unless the logs are somehow
fabricated :)
The cause of the crash however could be anything! Have a try at
repeating it by dropping newer Wars and Jars. Upgrade your Java
runtime to apply all the officially available fixes. Quit running
Tomcat as root :)
Regards,
Mich
nce for each
HTTP daemon?
Is this something to do with...
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Does this Log4j configuration usually work?
Have you tried running on a recent version of Java 6?
Regards,
Michael Erskine.
erging ugly category of "Let's try
and get Log4j to billions of jobs that are already done perfectly by
other tools". Seriously, does nobody know how to use cron and
logrotate any more?
Regards,
Michael Erskine.
-
Check out org.apache.log4j.FileAppender.setBufferedIO(boolean)
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org
mon thread.
[*] not the LoggingEvent itself - it has excess baggage!
I recommend the book Java Performance Tuning by Jack Shirazi published
by O'Reilly. Not just for Java performance geeks but for ALL Java
developers! And ALWAYS read the code of any librari
>From the looks of it I suspect you're made a call to
BasicConfigurator.configure()
Regards,
Michael Erskine.
On 25 February 2010 16:26, ragz_82 wrote:
>
> I am writing logs for my application using Log4j and I need to use only
> FileAppender. Right since the beginning, th
If you're concerned about performance then just code sensibly: when a
call is going to be expensive just do what's right and check the
logger level. Who cares if it involves an extra if statement?
Regards,
Michael Erskine.
--
nt of
data stored in each file like the RollingFileAppender maxFileSize
property or an of the other complexities.
I shudder to think of the comprehensive unit test suite to thoroughly
validate and verify a unified DailyRollingFile/RollingF
GMT] 000f SystemErr R
> java.net.ConnectException: Connection refused: connect
Sorry, but I have to ask: is there a suitable socket server listening on port
4445 of localhost? Unless you have a permanent logging server I suggest you use
a SocketHubAp
text log or write a
custom appender that is a "prepender" with an ajax servlet if I wanted to get
fancy web output.
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging
Sounds like the contextual information isn't being popped off the stack -
ensure your EJBs are being properly finalised and destroyed.
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user-uns
I suggest you create a custom rolling file appender to do exactly what you need.
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h
placed?
Hi Kay,
People usually roll their own replacement JDBCAppender: it's a lot of hassle
trying to create a one-size-fits-all database appender as everybody's
requirements are different (I know because I've tried and failed :
pender (NB: costly to collect) call
LoggingEvent.getThrowableStrRep() and handle it however you like.
Regards,
Michael Erskine.
> -Original Message-
> From: Alexander Spitzer [mailto:aspit...@gmail.com]
> Sent: 28 September 2009 20:58
> To: Log4J Users List
> Subject: Re:
overridable method for "Throwable" as the second parameter, and so my
> method for:
>
> protected void append(LoggingEvent event, Throwable exin)
>
> just gets ignored.
Alex,
You're confusing Appender methods with Logger methods!
Regards,
Michael Erskine.
d out after 30 days of
uptime that there's no audit trail!
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org
le in the Appender class for a short while. Logging
is pretty important for the work I do so it's all about well-tested graceful
failure and fallback.
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-
se on this.
>
> Thanks,
> Krishna
Forgive me for being glib but the answer is to fix your code :)
Regards,
Michael Erskine.
Why not use grep and cron?
(There seems to be an endless movement to try and make Log4j perform the tasks
already performed perfectly by established tools!)
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user
> This works fine in Windows
> but when run on Unix it actually creates a file called "nul".
That's because what you're doing is Windows specific. Fix that if you need a
cross-platform configuration.
sure those familiar with the shortcomings of JDBCAppender just write their
own custom appender - it's not too difficult and you get just what you need. I
would release my source code if my work contract allowed it. I can outline
details if anyone wants them.
he source of
org.apache.log4j.net.SocketHubAppender for a good example of management of the
stream with the appropriate flush and reset methods.
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user-unsubscr...@loggin
mail the list if all else fails (some choose to do this as their first
step :) )
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org
n every week - it isn't hard to redirect stdout
and stderr and any programmer should able to do it.
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-m
** Background thread to process async queue */
private Thread bg_thread;
/** Set when shutdown */
private boolean shutdown = false;
/**
* A logged event that is queued for writing to the logging database in a
* background thread.
*
* @author Michael Erskine
int len) throws IOException {
// log here in threadsafe manner
}
}
Enjoy!
Michael Erskine.
-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org
g/apache/log4j/DailyRollingFileAppender.html#setDatePattern(java.lang.String)
respectively.
Enjoy,
Michael Erskine.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
ot;
C:/eclipse/workspace/monitor/monitorClient/src/config/log4j.xml" to point log4j
straight at your config.
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
awk, and bash. Of course
some tools need getting used to before becoming the most useful :) .
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
> how do I set and get DatePattern attribute from a
> DailyRollingFileAppender, in code?
Hi Reza,
I don't want to sound "all RTFM" :) but the DailyRollingFileAppender has
methods getDatePattern and setDatePattern! Perhaps a glance at the code? :)
Reg
g4j configuration created if one has not already
been configured explicitly (or, perhaps, automagically).
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
eCheck.check();
}
...and here follows a version of the class suitable for redistribution.
Enjoy,
Michael Erskine
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
/**
* Occasionally we find a JUnit test suite or test case clas
erfacing.
I have a strong belief that any non-trivial networked communications system can
be generalised to IRC!
Just my 2 euros :)
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
cious buffering and filtering of course!)
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
hilst I use this technique extensively, I was
quoting from the Introduction to log4j...
http://logging.apache.org/log4j/1.2/manual.html
I suggest you read it and if you want more detail feel free to read the source.
If you still can't solve your problem feel free to ask for more help.
Regards,
M
Or does the
> log4j.xml
> configuration overrides the settings in the class files ??
If you don't want log4j to avoid the default initialization procedure you can
set the log4j.defaultInitOverrride system property to anything other than
"false".
Regards,
Michael Erskine.
--
thing up to connect to many servers, keep the connections
up, render the logged events, queue them for writing to the databases, write to
the databases asynchronously with DB connection pooling and recovery, etc.,
etc. Lots of scope for fun here!
Regards,
Michael Erskine.
-
7;t rely on any particular logging
framework at runtime - keep it optional.
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
pretty simple stuff -- I
learned most of how Log4J works by stepping through the source in Eclipse.
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
ConsoleAppender to
debug what your app is doing and set a threshold of INFO on your JDBCAppender.
The JDBCAppender is shoddy anyhow - write yourself a replacement. It's a great
way to learn about what makes a good Appender.
Regards,
Michael Erskine.
---
bly crafted JDBC appender (I'll publish it
one day!)
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
timing...
long t1 = System.nanoTime();
function_n();
long t2 = System.nanoTime();
logger.debug("duration in nanos: "+(t2 -t1));
Regards,
Michael Erskine.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
in their package names.
Here's the author's page...
http://www.dankomannhaupt.de/projects/index.html
...I looked into using this JDBC appender but after reading some of the source
I decided to write my own.
Regards,
Michael Erskine.
me and is included in
my eclipse JUnit templates.
> Is there a log4j class that I can call methods on directly to set up the
> above three things?
Logger.getRootLogger() is your starting point. Then you can configure
individual Appender instances to
my main class
(System.setProperty("log4j.defaultInitOverride", "true");). Then I am free to
programmatically configure log4j just so.
It follows, however, that if any of your libraries do something similar then
Personally, I'd just log everything to a single file and filter it with a
simple Perl script either after the fact or in a POE file tail app.
Just my two cents
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
Stream(s.getInputStream());
while (true) {
LoggingEvent event = (LoggingEvent) ois.readObject();
log.debug("remote event:'" + event.getMessage() + "'");
}
You can get fancy with it and have the "receiver" app do whatever you like with
the messages
Whoops!
> long now = System.currentTimeMillis();
> File[] files = getExpiredLogfiles(fileNameRoot, datePattern, null,
> new Date(now + maxage));
That Date should be new Date(now - maxAge) since maxAge is defined as...
private static long maxage = 7 * DateUtils
> From: dirk ooms [mailto:[EMAIL PROTECTED] 10 December 2007 10:53
> your script could just look at the 'last edit' time of the file, without
> having to look at the name of the file.
That's a good idea Dirk but I'd prefer to stick to the spec (since that's what
the customer's acceptance tests wi
f this
has been done elsewhere (probably better!).
Kind Regards
Michael Erskine
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
54 matches
Mail list logo