查看“︁Java打印文件名、函数名、行号”︁的源代码
←
Java打印文件名、函数名、行号
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于这些用户组的用户执行:*、
用户
您可以查看和复制此页面的源代码。
<pre class="prettyprint"> Log.d(TAG,new Exception().getStackTrace()[0].getMethodName()); //函数名 Log.d(TAG, Thread.currentThread().getStackTrace()[2].getMethodName()); //函数名 Log.d(TAG, ""+Thread.currentThread().getStackTrace()[2].getLineNumber()); //行号 Log.d(TAG, Thread.currentThread().getStackTrace()[2].getFileName()); //文件名 //文件名+行号 Log.d(TAG, "["+Thread.currentThread().getStackTrace()[2].getFileName()+","+Thread.currentThread().getStackTrace()[2].getLineNumber()+"]"); </pre>
返回
Java打印文件名、函数名、行号
。
导航菜单
个人工具
创建账号
登录
命名空间
页面
讨论
大陆简体
查看
阅读
查看源代码
设置
查看历史
更多
搜索
导航
首页
Ubuntu
Android
C&CPP
Java
Python
AI
大杂烩
最近更改
工具
所有页面
文件列表
页面信息
特殊页面