<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
</head><body text="#000000" bgcolor="#FFFFFF">Hello,<br>
<br>
Thank you for your suggestion of add the ClassLoader. I don't know why I
didn't think of that. Maybe it's because I'm fairly new to Java.<br>
<br>
I added the following two lines to my HelloWorld.java class:<br>
<br>
String URL = "logback.xml";<br>
System.out.println(ClassLoader.getSystemResource(URL));<br>
<br>
The output I receive on the console looks like this:<br>
<br>
<a class="moz-txt-link-freetext" href="file:/Users/roger/NetBeansProjects/HelloWorld/build/classes/logback.xml">file:/Users/roger/NetBeansProjects/HelloWorld/build/classes/logback.xml</a><br>
12:30:01.762 [main] DEBUG helloworld - Hello world.<br>
<br>
When I open the logback.xml file that is listed in the console output,
it looks exactly like the custom logback.xml file I created.<br>
<br>
The problem still exists that it's not picking up on the custom pattern I
have in logback.xml. That pattern looks like this:<br>
<br>
<pattern>%date %n [%thread] %level %logger{35} - %n
%msg</pattern><br>
<br>
<br>
I would have expected to see the date followed by a jump down to a new
line followed by [main] followed by a jump down to a new line and etc.
etc etc.<br>
<br>
Am I wrong to think logback uses %n as new line characters?<br>
<br>
My experience has been with log4j and %n generates the newline in its
pattern.<br>
<br>
Thanks again,<br>
Rogert<br>
<br>
<blockquote style="border: 0px none;"
cite="mid:B1647D9F-1701-4E64-B162-465CAF548BEF@gmail.com" type="cite">
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px"> <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="adam.n.gordon@gmail.com" photoname="Adam Gordon"
src="cid:part1.04010006.03030704@northweststate.edu"
name="postbox-contact.jpg" width="25px" height="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
<a moz-do-not-send="true" href="mailto:adam.n.gordon@gmail.com"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Adam Gordon</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">January 20, 2012
12:13 PM</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody"><div>The XML file needs to be
in your class path. The first thing I would check is to see if you can
load the file as a resource with ClassLoader.getResourceAsStream(String)
or similar. If this is able to load the file, then it's on your class
path and I'm not sure what the problem is but it's something to
eliminate as an issue first.<br><br>In my maven project, I have it in
src/main/resources and everything is happy.<br><br></div><div><!----><br><br></div><div>_______________________________________________<br>Logback-user
mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br><a class="moz-txt-link-freetext" href="http://mailman.qos.ch/mailman/listinfo/logback-user">http://mailman.qos.ch/mailman/listinfo/logback-user</a></div></div>
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px"> <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="rspears@northweststate.edu" photoname="Roger Spears"
src="cid:part2.00090400.03020005@northweststate.edu"
name="compose-unknown-contact.jpg" width="25px" height="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
<a moz-do-not-send="true" href="mailto:rspears@northweststate.edu"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Roger Spears</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">January 20, 2012
12:07 PM</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody">Hello,
<br>
<br>I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm
currently using log4j without any problems. I wanted to try out
logback.
<br>
<br>Yesterday I downloaded logback and placed the 4 jar files in the
proper
location. I'm able to run the basic logback HelloWorld example. Here's
the code for the HelloWorld example I'm working with:
<br>
<br>package helloworld;
<br>
<br>import org.slf4j.Logger;
<br>import org.slf4j.LoggerFactory;
<br>
<br>public class HelloWorld {
<br>
<br> public static void main(String[] args) {
<br>
<br> Logger logger = LoggerFactory.getLogger("helloworld");
<br> logger.debug("Hello world.");
<br>
<br> }
<br>
<br>}
<br>
<br>Here's my customized logback.xml file:
<br>
<br><configuration>
<br><appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<br><encoder>
<br><pattern>%date %n [%thread] %level %logger{35} - %n
%msg</pattern>
<br></encoder>
<br></appender>
<br><root level="DEBUG">
<br><appender-ref ref="STDOUT" />
<br></root>
<br></configuration>
<br>
<br>The problem is...Netbeans (or java) never picks up on my customized
logback.xml file. I'm starting out easy by just changing the pattern to
see if I can get it to work. When I run the project, I see the
following on the console:
<br>
<br>11:56:33.569 [main] DEBUG helloworld - Hello world.
<br>
<br>That's not the pattern I specified in logback.xml.
<br>
<br>I'm assuming I just don't have it in the proper location. I have a
copy
of logback.xml in the following locations just to see if I had it in the
wrong place:
<br>
<br>NetBeansProjects -> HelloWorld -> src -> logback.xml
<br>
<br>NetBeansProjects -> HelloWorld -> logback.xml
<br>
<br>NetBeansProjects -> HelloWorld -> nbproject -> private
-> logback.xml
<br>
<br>NetBeansProjects -> HelloWorld -> build -> classes ->
logback.xml
<br>
<br>System -> Libraries -> Java -> Extensions -> logback.xml
<br>
<br>
<br>I am still unable to get the pattern I'm looking for.
<br>
<br>Does anyone know why this would be happening?
<br>
<br>Thanks,
<br>Roger
<br></div>
</blockquote>
<span style="mso-bookmark:OLE_LINK1"><span
style="mso-bookmark:OLE_LINK2"><span
style="font-size:11.0pt;font-family:"Times New Roman""><o:p></o:p></span></span></span><span>
</span></body></html>