Okay, I've gotten this working. I should note that the hostname System
property must be fed as a JVM argument (the blog post uses -Dhostname=`uname
-n`).
I've noticed an odd issue with parentheses, though. Including a closing paren
(matched or not) truncates the rest of the format and pulls up the next line in
the message. So this format:
[CFG_SERVER] =${hostname}= ) %logger{20} - %m %nopex
Gives the email subject:
[CFG_SERVER] =dv1035c= java.io.FileNotFoundException: /tmp/cfg_server.data
(Permission denied) at java.io.RandomAccessFile.open(Native Method)
<snipped remainder of stack>
Removing the closing paren:
[CFG_SERVER] =${hostname}= %logger{20} - %m %nopex
Produces the expected output:
[CFG_SERVER] =dv1035c= n.s.e.s.DiskStore - cfg_serverCache: Could not create
disk store. Initial cause was /tmp/cfg_server.data (Permission denied)
What would cause this behavior?
Thanks,
-Chris
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ceki Gulcu
Sent: Tuesday, September 30, 2008 4:40 AM
To: logback users list
Subject: Re: [logback-user] Hostname in SMTPAppender subject
Hello Chris,
It should work the same way. If it doesn't, it is a bug. If so, I would
appreciate if you could file a bug report at http://jira.qos.ch/
Regards,
Mayes, Christopher wrote:
> Hi, there.
>
> Is there a way to get the reporting machine's hostname into the subject of
> the SMTPAppender's email address? According to a blog post,
> (http://blog.spiralarm.com/richard/2007/10/watching-production-logs.html) you
> can do something like this for log4j:
>
> <param name="Subject" value="[SMTPAppender] [EMAIL PROTECTED] error message"
> />
>
> Is there a Logback equivalent?
>
> Thanks,
>
> -Chris
--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user
_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user