facebook

java.util.Logging being marked as errors

  1. MyEclipse Archived
  2.  > 
  3. Web Development (HTML, CSS, etc.)
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #226401 Reply

    nkibble
    Member

    Hi,
    I’m trying to make use of the java.util.logging classes within a JSP page, using MyEclipse.
    Using the sample source below, the editor is underlining the getLogger(), addHandler() and info() method calls, as though it doesn’t recognise the class. I am using Tomcat 5.5 and JDK 1.5, and am using Eclipse 3.0 with MyEclipse 3.8.4.

    The JSP does work, but it’s annoying that the editor is acting as though there are errors in the code.

    I’d appreciate any guidance.

    Sample source below:

    %@ page language=”java” import=”java.util.logging.*” %
    %
    Logger logger = Logger.getLogger(“example”);
    logger.addHandler(new ConsoleHandler());

    String info = request.getParameter(“info”);
    if (info != null && !info.equals(“”)) {
    logger.info(info);
    }
    %

    #226405 Reply

    Riyad Kalla
    Member

    Is this the EXACT code you are using, or did you manually omit the < and > before and after your %’s just for the post here in the forums? I just pasted in your code and fixed it and closed/reopend the file and it was fine (try that):

    
     <%@ page language="java" import="java.util.logging.*" %>
    <%
    Logger logger = Logger.getLogger("example");
    logger.addHandler(new ConsoleHandler());
    
    logger.setFilter(null);
    
    String info = request.getParameter("info");
    if (info != null && !info.equals("")) {
    logger.info(info);
    }
    %>
    
    #226408 Reply

    nkibble
    Member

    Wow, that’s a quick response!

    I did take out the < and > symbols, in order to be able to post the request.
    I get getLogger(“example”), .addHandler(..) and .info(info) underlined ( in red).

    Could there be an issue with my setup? I installed MyEclipse and just started using it. Prior to this, everything has worked fine.

    #226411 Reply

    Riyad Kalla
    Member

    I get getLogger(“example”), .addHandler(..) and .info(info) underlined ( in red).

    If you mouse over in the right margin ontop of the red blocks marking the errors, what is the error message?

    #226465 Reply

    nkibble
    Member

    I’m sorry, I’ve realised what this was now.
    I called my JSP file “Logger.jsp” and this seems to be confusing MyEclipse. I’ve renamed the file to “LoggerJSP.jsp” and this has sorted the issue out. D’oh!

    Just out of interest, why would this cause MyEclipse to get confused? Does it class Logger.jsp as a class?

    #226469 Reply

    Riyad Kalla
    Member

    Ahhh yes this is a subtle bug we need to fix, the JSP is getting generated and compiled to a filename that conflicts with the Logger.class from the JDK, we are looking into this.

    #226471 Reply

    nkibble
    Member

    Thanks for the update, I’ll keep this in mind.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: java.util.Logging being marked as errors

You must be logged in to post in the forum log in