logging by EJB

Discussions

EJB design: logging by EJB

  1. logging by EJB (8 messages)

    Hi! Now I'm in a project using EJB and revising logging system. We can get a log file per a VM on which there are several componets. But It's impossible to get log files sorted by EJB components on a single VM. And I cannot find any tools or API's that make it possible so far. Did anybody experience the same situation? or is it abnormal to devide log files by EJB components on a VM? I appreciate any ideas, thank you.

    Threaded Messages (8)

  2. logging by EJB[ Go to top ]

    I have to admit having very limited experience on logging frameworks, but I have the impression that Log4j can be configured to use a number of "logging sinks" (can't remember the official name) to which different types of logging are directed to -- maybe you could define this kind of a "sink" for each of your EJBs. You probably have already taken a look at log4j, but just in case...
  3. logging by EJB[ Go to top ]

    I thought that the specification does not authorize the use of java.io
    package
    in EJB. If you use a logger tool like Log4j, that means implicitly that
    you use java.io package, doesn't it ?
  4. logging by EJB[ Go to top ]

    You mean that it's impossible to use java.io package in EJB? I think that java.io is just a java package and we can refer it if java-environment is there. If I miss something in EJB,pls. point it out. Thhak you.
  5. logging by EJB[ Go to top ]

    In fact, the EJB Specification has many programming restriction (chapter 24.1.2
    in EJB 2.0 spec) : no use of java.io package, no use of threads, no use of input from keyboard and output to display, etc...
  6. logging by EJB[ Go to top ]

    The subject of using I/O from the EJB layer has been discussed from time to time on this forum and probably on dozens of others. I'd suggest you look up these threads and try to figure out what to do in YOUR project.

    Here are some pointers, though:
    - The application servers don't prevent you from using java.io.* even if the spec says you shouldn't
    - Most EJBs use some kind of I/O resource indirectly, e.g. business methods wrapping database calls, calling a remote EJB over the network, etc. The question is more about how to encapsulate these operations and protect the EJB from blocking issues and such.

    But I'm not the expert on this matter -- lookup those threads.
  7. logging by EJB[ Go to top ]

    Thanks for your comment.I probably what you're talking about,I also forgot the official name though.You mean that it's possible to log one file to the console and another to files,don't you? Actually I want all logs to files. Now I get to think that maybe we make it up for ourselves. I appreciate your cooperation!
  8. Use Log4j[ Go to top ]

    Using log4j you can create a separate appender for each ejb and specify a different file for each appender. This works for me.
  9. Use Log4j[ Go to top ]

    We write our logs to a file but not directly from with the ejb. Our app uses a utility logger class that is based on log4j. We haven't have any problem doing so although Spec says not use the java.io

    Hope this helps.