我的日志消息在哪里?

时间:2012-03-16 22:06:24

标签: android logging

我有这样的源文件:

...
import android.util.Log;
...
public class MyActivity extends Activity
{
    public static Activity activity = null;
    private static final String TAG = "WorldDetermine";
    private Camera mCamera;
    private CameraPreview mPreview;
    public final int cameraId = 0;

    @Override
    public void onCreate(Bundle savedInstanceState) {
    Log.d("myTag", "onCreate started!");
    Log.v("blah", "blah blah");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); ...

并尝试按logcat获取日志消息。像这样:

adb -s emulator-5554 logcat myTag:D blah:v *:S

但只有空白输出(grep也找不到这个)。我的项目由ant debug正确编译,但我在最后一步遇到问题(这个问题可以间接引起吗?):

debug:

BUILD FAILED
/home/psct/development/android-sdk-linux/tools/ant/build.xml:887: The following error occurred while executing this line:
/home/psct/development/android-sdk-linux/tools/ant/build.xml:342: The following error occurred while executing this line:
/home/psct/development/android-sdk-linux/tools/ant/build.xml:334: Problem: failed to create task or type propertyfile
Cause: the class org.apache.tools.ant.taskdefs.optional.PropertyFile was not found.
        This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
        -/usr/share/ant-core/lib
        -/root/.ant/lib
        -a directory added on the command line with the -lib argument

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem


Total time: 4 seconds

1 个答案:

答案 0 :(得分:0)

在/ android-sdk / tools文件夹中启动ddms文件,您将看到所选设备的详细输出。日志将输出。无需使用控制台:)