This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!

Hilda Stone

Greenhorn
+ Follow
since Jan 03, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hilda Stone

Now I think the best way to handle the case when an exception is thrown during filter's doFilter method should be --- just log the error information and let it pass to next filter in filter chain.  This should make more sense than send it to 500 error page, right ?  See, if we get exception in doFilter, it doesn't mean we shouldn't move on to the next filter.
2 days ago
Thanks.  But user can only get to the destinaton page of servlet AFTER it passes the filter.  If RuntimeException is thrown in filter how can user get to the page ?
5 days ago
Many years ago there were Sun Certified Java Programmer (multiple choice exams),  Sun Certified Java Developer (project and exam).

Today we have "OCA Jave 8 Programmer" and  " OCP  Java 8 programmer".  How do they map to the SUN certificate in terms of level and difficulty ?

Thanks.
If a servlet (inside a web app) filter throws run time exception in its doFilter(..) method, will the web app basically be down ?
1 week ago
when I set "hibernate.show_sql" to true, I can see hibernate printouts like "update mytable set column_1 = ?"   but I can't see the real value for that "?".  What setting should I change to see the real run time value ?
Having one JSP (main.jsp) that includes another JSP (child.jsp).   In child.jsp there is some <div id="testId" ...>.  In main.jsp, attempt to use jQuery like

$("#testId").xxx  but it seems it doesn't work.. Any idea ?
Is it true if I use @Component (or @Named), I should include this class' package in the component scan's base package, but if I use @Bean then I don't have to make this class be inside any component scan package ?
6 months ago

Knute Snortum wrote:I was able to get commons-logging log4j working on my test project without configuring more than log4j.  All I can offer is some "gotta ask" dumb questions.

* I noticed that you have log4j.rootCategory=INFO, file in your log4j configuration, but you have log.debug() in your code.
* Have you tried it without any commons-logging configuration?



Thanks for pointing the INFO thing, but actually it wasn't the reason since I was just giving an example, even when I used DEBUG it was same.  I also found when my java code uses SLFJ it also works.  Only when my java code uses common.logging it somehow can't write to the file using the log4j.properties.
I found there is some problem when I use commons.logging in java code, like


Then in log4j.properties


I even have a commons-logging.properties:



Still, it doesn't write to the log file, it creates the file but can't write anything to it.

However, if I simply change my java code into



it immediately works and writes to the file.  WHy ? and how can I resolve the issue without changing my java code ?
is it ok to put log4j.properties under WEB-INF/  ?  I tiried and it seems ok but  I saw some people put it under WEB-INF/classes...  Where should it be put ?  Thanks
copy an example from internet,  suppose we have a structure com.me.proj2..

****
log4j.rootLogger=INFO, stdout

log4j.logger.com.me.proj2=DEBUG
*****

Does that mean

1. for classes under com.me.  their level is INFO, i.e.  the BEBUG statements  in these classes can't be recorded by log4j

2. For classes under com.me.proj2. their level is DEBUG, i.e all the DEBUG statements  in these classes  can be recorded by log4j

Am I right ?
Thanks Tim.  What if the server isn't tomcat but is something like Weblogic or Websphere , is the answer still same ?
7 months ago
I have a question about log4j.  It is about the precedence and coverage of java package's log4j.

suppose I have a code structure like

com.university.department.xxx

if I set log4j.logger.com.university.department=DEBUG

For the classes under com.university.landscaping.xxx,  are these log statement missed (assuming I have lot of logger.DEBUG in these classes under com.university.landscaping) and couldn't be logged ??

if I set log4j.logger.com.university=DEBUG, then is it true ALL the classes under com.university (directly or indirectly meaning under any sub folder under university) will get their .DEBUG statements logged (in this case all classes under com.university.department and com.university.landscaping and com.university will be logged) ?
If you create a Dynamic Web project in Eclipse J2EE editor, it asks if you want to "add to a EAR project", and if you check it, it auto creates a EAR project in addition to the web project.  But if you end up with only working on this web project, I don't think you would really need this EAR project...  So my question is --- Even you checked "yes" to "Want to add to a EAR project" while creating the web project, you don't need to deploy the EAR project, right ? i.e. when you deploy to your server (like tomcat), you can simply choose the WAR web project when it asks "Add and remove" application to the server, right ?
7 months ago