English 中文(简体)
是否存在用于记录档案的Eclipse plugin?
原标题:Does exists Eclipse plugin for log files?

I have check very long logs after each start of Tomcat (from Eclipse). Does exist a plugin or editor that I can use inside Eclipse? At least it must have colored for errors, debug and info messages. Thanks.

最佳回答

我建议使用Log4j:

http://logging.apache.org/log4j/1.2/

http://en.wikipedia.org/wiki/log4j

它用ec子做大量的工作,并建立了彩色计划。 它是高度定制的,需要一些时间来说明,但值得一提。

问题回答

除了yn色外,这样做的守则非常简单。 只是启动一个原始项目,为org.eclipse.ui.console添加附属条件,并做如下一些事情:

public void log() {
    BufferedReader br = new BufferedReader(new FileReader("path of log file"));

    String line = null;
    while (br.nextLine ) {
        line = br.readLine();
        if (line == null) {
            Thread.sleep(1000);
        }
        else {
            MessageConsole console = findConsole("tomcat log");
            MessageConsoleStream stream = console.newMessageStream();
            stream.println(message);
        }
    }
}

private MessageConsole findConsole(String name) {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (IConsole element : existing)
        if (name.equals(element.getName()))
            return (MessageConsole) element;
    // no console found, so create a new one
    MessageConsole myConsole = new MessageConsole(name, null);
    conMan.addConsoles(new IConsole[] { myConsole });
    return myConsole;
}




相关问题
In Eclipse, why doesn t "Show In" appear for non-Java files?

If I have a *java file open, I can right click on the source, scroll down to "Show In (Alt-Shift-W)", and select Navigator. If I have an *xml, *jsp, or pretty much anything besides a Java source ...

Eclipse: Hover broken in debug perspective

Since upgrading Eclipse (Galileo build 20090920-1017), hover in debug no longer displays a variable s value. Instead, hover behaves as if I were in normal Java perspective: alt text http://...

Eclipse smart quotes - like in Textmate

Happy Friday — Does anyone know if eclipse has the notion of smart quotes like Textmate. The way it works is to select some words and quote them by simply hitting the " key? I m a newbie here so be ...

Indentation guide for the eclipse editor

Is there a setting or plugin for eclipse that can show indentation guides in the editor? Something like the Codekana plugin for visual studio (not so fancy is also OK). Important that it works with ...

Adding jar from Eclipse plugin runtime tab

I want to add .jar files for plugin from the Runtime tab of manifest file. When I use the Add... button, I can see only sub-directories of the plugin project. So if I want to add same .jar file to ...

How to copy multiple projects into single folder in eclipse

I have two projects, Project1 and Project2. Now i want to copy this projects into eclipse workspace but i want these projects to be in a single folder like below. Eclipse Workspace -> Project -> ...

Java: Finding out what is using all the memory

I have a java application that runs out of memory, but I have no idea which code is allocating the memory. Is there an application with which I can check this? I use Eclipse.

热门标签