我已经编译了一个 LibreOffice 扩展并生成了一个我添加到 LibreOffice 的 OXT 文件。
在 LibreOffice 中进行测试时,有什么方法可以查看此扩展中发生的所有 java 日志记录?
我已经编译了一个 LibreOffice 扩展并生成了一个我添加到 LibreOffice 的 OXT 文件。
在 LibreOffice 中进行测试时,有什么方法可以查看此扩展中发生的所有 java 日志记录?
You have to add your own logging. i have successfully used log4j with my java LO extension. just add the log4j.xml file to the generated LO extension jar. assumimg your log4j.xml file it at top level of your LO generated jar and that you added log4j.jar to your project classpath before compiling and generating the extension jar. then in your main class entry for LO java extension in initialize() method you can configure your log4j with following code:
// com.sun.star.lang.XInitialization:
/**
*
* @param object
* @throws com.sun.star.uno.Exception
*/
@Override
public void initialize(Object[] object)
throws com.sun.star.uno.Exception {
//some init stuff here
//initialize log4j
DOMConfigurator.configure(getClass().getResource("log4j.xml"));
_logger = Logger.getLogger(YourExtensionClassName.class);
}
好的老派 System.out.println() 也可以工作,至少在 LibreOffice 调试(每晚)构建中。我从命令行运行 LO 并在控制台中查看标准输出。我在 Linux 机器上使用 LO。