oracle system.out.println 输出在oracle java 类中的哪里
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4267545/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
where does system.out.println output goes in oracle java class
提问by prabhakar
I have loaded a java class into oracle using loadjava utility
我已经使用 loadjava 实用程序将一个 java 类加载到 oracle
This class has some system.out.println messages.
这个类有一些 system.out.println 消息。
When I execute a method from this class I want to see the the sysout messages.
当我执行此类中的方法时,我想查看 sysout 消息。
Can anyone tell me where can I find these messages?
谁能告诉我在哪里可以找到这些消息?
回答by oluies
System.out and System.err writes to the current trace files
System.out 和 System.err 写入当前跟踪文件
You can enable output to SQL*Plus or similar with
您可以启用输出到 SQL*Plus 或类似的
set serveroutput on size 10000
exec dbms_java.set_output(10000)
将服务器输出设置为 10000
执行 dbms_java.set_output(10000)
See the Java Developer's Guidehere
请参阅此处的Java 开发人员指南
That said you should ask yourself, what do I want to log, that my client would not like to see returned in the interface to my procedure. The answer to that is usually nothing.
也就是说,您应该问自己,我想记录什么,我的客户不希望在我的程序的界面中看到返回的内容。答案通常是否定的。
I have been able to setup http://www.slf4j.org/with a jdbc database appender (unsure of the specifics)
我已经能够使用 jdbc 数据库附加程序设置http://www.slf4j.org/(不确定细节)
回答by darioo
An Oracle articleprovides some useful info.
一篇 Oracle文章提供了一些有用的信息。
Quote:
引用:
Your class:
你的班:
public class SimpleJava {
public void main(String[] args) {
System.out.println("Here we are");
}
}
Now, compile and load your class:
现在,编译并加载您的类:
C:\oracle9i\bin>javac SimpleJava.java
C:\oracle9i\bin>loadjava -user scott/tiger SimpleJava.class
From SQL*Plus, create the PL/SQL wrapper to invoke the newly loaded Java class:
在 SQL*Plus 中,创建 PL/SQL 包装器以调用新加载的 Java 类:
SQL> create or replace procedure call_simplejava
2 as language java
3 name 'SimpleJava.showMessage()';
4 /
Execute the code from SQL*Plus:
从 SQL*Plus 执行代码:
SQL> set serveroutput on;
SQL> call dbms_java.set_output(50);
Call completed.
通话完毕。
SQL> execute call_simplejava;
Here we are