本地调用Documentum库执行DQL时,SQL跟踪日志位置咨询
本地调用Documentum自定义库时,DQL执行的SQL跟踪日志位置在哪里?
我希望获取执行DQL时所有SQL查询的日志。在远程机器上直接使用API测试器执行时可以正常看到日志,但当我从本地机器连接远程实例,调用自定义库执行时,却找不到这些日志。
我已尝试以下两种启用rpctrace的方法:
方法一
public static void enable(IDfSession session) throws DfException{ IDfApplySetOptions applyCommand = (IDfApplySetOptions) DfAdminCommand.getCommand(IDfAdminCommand.APPLY_SET_OPTIONS); applyCommand.setOption("rpctrace"); applyCommand.setValue(true); applyCommand.execute(session); }
方法二
public static boolean enable2(IDfSession session) throws DfException{ IDfCollection coll = null; try { coll = session.apply( null, "SET_OPTIONS", new DfList(new String[]{"OPTION", "VALUE", }), new DfList(new String[]{"S", "B", }), new DfList(new String[]{"rpctrace", "T", })); if (coll.next() && coll.hasAttr("result")) { return coll.getBoolean("result"); } return false; } finally { if (coll !=null) { coll.close(); } } }
完整调用代码
public static void main(String[] args) throws IOException, DfException, FileNotFoundException { Properties props = new Properties(); props.load(Main.class.getResourceAsStream("/config.properties")); String docbase = props.getProperty("dfc.docbase.name"); String username= props.getProperty("dfc.username"); String password = props.getProperty("dfc.password"); IDfSession session = SessionUtil.getSession(docbase,username,password); SessionUtil.enable2(session); }
解答
- 默认日志位置在远程Documentum服务器
你通过本地DFC启用的rpctrace是针对远程Docbase会话生效的,对应的SQL跟踪日志默认输出在远程服务器的Documentum日志目录,而非本地机器:
- Windows系统:
C:\Documentum\server\log\<你的文档库名称>\ - Linux/Unix系统:
/opt/documentum/server/log/<你的文档库名称>/
日志文件名通常包含rpctrace前缀,或直接写入server.log文件,可根据日志生成时间筛选。
- 如何让日志输出到本地
若要在本地查看RPC跟踪日志,需修改本地DFC配置文件dfc.properties,添加以下参数:
# 启用RPC跟踪 dfc.trace.rpc=true # 指定本地日志文件路径 dfc.trace.rpc.file=<本地路径,比如D:\dfc_logs\rpctrace.log> # 确保日志级别足够详细 dfc.log.level=TRACE
修改后重启本地应用,再次执行DQL查询即可在指定本地路径看到日志。
- 注意事项
你当前的代码仅启用了rpctrace,但未执行任何DQL查询,需在启用代码之后添加DQL执行逻辑,否则不会生成日志。
内容的提问来源于stack exchange,提问作者Q_Q_
相关产品推荐
相关产品推荐

