Android - 通过Logcat Manager简单获取Android手机的Log

由于工作需要,经常需要获取Android手机的Log。

平常都是通过adb命令来获取,每次都要写命令。

偶然的一个机会,我从外网发现了一个工具 Logcat Manager,只需要通过简单的双击即可获取Android的Log,这里也分享一下。

目录

1, 设定手机为开发者模式,并打开USB debugging

1-1,连续快速点6次 Build number 打开Developer 开发者模式

1-2,设置为USB访问可

2,用USB线连接Android手机到PC

3,通过Logcat Manager 获取Log

3-1,展开zip包

3-2,设置快捷方式(不是必须的)

3-3,获取Log

1),双击打开bat文件

2),选择获取Log的选项

3),确认获取的Log


下面说一下通过该工具获取Android手机Log的步骤。

1, 设定手机为开发者模式,并打开USB debugging

如何设置开发者模式,可以参照如下文章。

Android - Pixel 6a 手机OS 由 Android 15 降级到 Android 14 操作记录_安卓15怎么降到安卓14-CSDN博客

为了阅读方便,我也给转记到这里来:

1-1,连续快速点6次 Build number 打开Developer 开发者模式

点完之后会提醒你已经是开发者模式了

1-2,设置为USB访问可

回到上一层,点System,下拉到 Developer Option,点进去

把 USB debugging 打开

2,用USB线连接Android手机到PC

注意用一条紧实的线,不然的话,Log的取得就会中断。

3,通过Logcat Manager 获取Log

3-1,展开zip包

这里面咱们要使用的就是这个AIO_Logcat_Manager.bat文件

这里我也贴一下该bat文件的代码。

其实你细看的话,它是调用adb来获取log,所有本身并不算是新知识,属于一个功能的包装,可以提高效率,减少运用难度。

@echo off
COLOR 0F
setlocal enabledelayedexpansion
IF (%1)==(0) goto logo
mode con:cols=82 lines=46
mkdir Logcat_Output
set model=adb shell "cat /system/build.prop | grep "ro.product.model""
set appname=None:logo
cls
ECHO.
ECHO.
ECHO.
echo                             `---..` ``````````..---`
echo                             `----------------------.
echo                             `----------------------.
echo                            `------------------------.
echo                            --------O--------O--------.
echo                            ---------------------------
echo                            ------------bd------------.
echo                            .-------------------------.
echo                             .--------\----/---------. 
echo                              `.--------------------`
echo                           ``    ``...--------...`
echo                            `..     `---------`
echo                             `...``.--.--.--.--
echo                               `....--`--`--`--
echo                                    .-`--`--`--
echo                                 `` .-`--`--`--``..
echo.
echo.
echo                          .//`     -:::-   //::///:`                     
echo                          mMMM+    +MMMmodMMm: +MMMhhMMM-                    
echo                         +MdMMMs    MMMy `NMMM``MMMhhMMd`                    
echo                        /MModMMMo  `MMMy  mMMM..MMMdyMMMh                    
echo                      `+MMs+oNMMMo.:MMMd:sMMMo +MMMh/MMMN`                   
echo                      /yyy/ -syyys/sysssyys+. `yysssyys+`                    
echo.
echo.
echo        -syyys-     -osyyo:     :oyysos/   `:oyys+/.    /ys:     +yssssssy-  
echo        `sMMMs`   -mMMssNMMm- /NMMs/omMM` +NMNoohMMN   `MMMMs   +MNyMMMddMN  
echo         :MMM+    dMMM` :MMMN.MMMd  -:o+.-MMMy         hMsNMMy  `:`.MMMy --  
echo         -MMM+  +:hMMMy  NMMm`NMMM::yMMMy:NMMM+`      yMNhmMMMy    :MMMy     
echo        `sMMMdohMy`sNMMmdMMy. .hMMMddMNo  -dMMMMNMMo:hMM+./NMMMh- :hMMMm+    
echo        `:::::://   `-///-`     `:///-      `:///.  -///. ./` `:.    
echo.
echo.
ECHO.
echo                 ALL IN ONE ADB LOGCAT MANAGER FOR ANDROID DEVICES
echo                                 By: majdinj - xda
echo.
ECHO.
ECHO.
pause:ReadMe
cls
ECHO.
ECHO.
ECHO.
ECHO           ************************************************************
ECHO           ************************************************************
ECHO           **                                                        **
ECHO           **     Before you start, make sure of the followings:     **
ECHO           **                                                        **
ECHO           ************************************************************
ECHO           ************************************************************
ECHO.
ECHO.
ECHO.
ECHO           ************************************************************
ECHO           *                                                          *
ECHO           * 1. Your device USB driver is installed on your computer. *
ECHO           *                                                          *
ECHO           * 2. Your device is set on USB debugging mode.             *
ECHO           *                                                          *
ECHO           * 3. You connect your device to the computer by USB cable. *
ECHO           *                                                          *
ECHO           * 4. Your computer recognizes your device.                 *
ECHO           *                                                          *
ECHO           ************************************************************
ECHO.
ECHO.
ECHO.
ECHO.
echo Are you ready.. let's proceed? (any letter for YES, n or no for NO)
set /P INPUTP=Make your choice: %=%
IF "%INPUTP%"=="" (call :YContinue)
IF "%INPUTP%"==" " (call :YContinue)
IF "%INPUTP%"=="  " (call :YContinue)
IF "%INPUTP%"=="   " (call :YContinue)
IF "%INPUTP%"=="    " (call :YContinue)
IF "%INPUTP%"=="     " (call :YContinue)
IF %INPUTP%==n (call :NContinue)
IF %INPUTP%==no (call :NContinue)
IF %INPUTP%==nO (call :NContinue)
IF %INPUTP%==N (call :NContinue)
IF %INPUTP%==No (call :NContinue)
IF %INPUTP%==NO (call :NContinue)
:YContinue
ECHO.
ECHO.
ECHO.
echo  Proceeding...
ECHO.
ECHO.
ECHO               **************************************************
ECHO               *     Activating ADB Shell... Please wait...     *
ECHO               **************************************************
goto restart
:NContinue
ECHO.
ECHO.
ECHO.
echo  Quitting...
ECHO.
ECHO.
ECHO.
ECHO                **************************************************
ECHO                *        Come again once you are ready...        *
ECHO                **************************************************
ECHO.
echo.
timeout 4
EXIT:restart
cd "%~dp0"
cd %~dp0/tools
%model% > nul
IF %ERRORLEVEL% NEQ 0 (goto adberror)
cd "%~dp0"
set appname=None
goto MainMenu:MainMenu
COLOR 0E
cls
echo Date: %date%
echo Time: %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
cd %~dp0/tools
set /p "=Device ID: " <nul
%model%
cd "%~dp0"
echo.
echo  --------------------------------------------------------------------------------
echo.
echo                        All In One Android Logcat Manager v1
echo.
echo  --------------------------------------------------------------------------------
echo.
echo              1   Export Normal All levels logcat to txt file
echo              2   Export Normal Time-line logcat to txt file
echo              3   Export Normal Neat logcat to txt file
echo              4   Export Only Error level logcat to txt file
echo              5   Export Only Fatal level logcat to txt file
ECHO.
echo              6   Export All levels Radio logcat to txt file
echo              7   Export Only Error level Radio logcat to txt file
echo              8   Export Only Fatal level Radio logcat to txt file
ECHO.
ECHO              9   Special process filtered by name logcat mode
echo.
echo              10  Read exported logcat txt file in Logcat_Output folder
echo.
echo              11  Advanced Kernel logcat [NEEDS SU ROOT ACCESS PERMISSIONS]
echo.
echo              12  Clean Logcat_Output folder
echo              13  Terminate and exit ADB session
echo.
echo  --------------------------------------------------------------------------------
echo.
SET /P menu=Please make your decision:
IF %menu%==1 (goto all)
IF %menu%==2 (goto time)
IF %menu%==3 (goto neat)
IF %menu%==4 (goto error)
IF %menu%==5 (goto fatal)
IF %menu%==6 (goto Nradio)
IF %menu%==7 (goto Eradio)
IF %menu%==8 (goto Fradio)
IF %menu%==9 (goto MainMenu1)
IF %menu%==10 (goto fileselect)
IF %menu%==11 (goto MainMenu2)
IF %menu%==12 (goto clean)
IF %menu%==13 (goto termexit)@REM If you got here, it wasn't 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, or 13
echo.
echo.
ECHO                 *************************************************
echo                 *    Are you crazy.. choose something exist.    *
ECHO                 *************************************************
echo.
echo.
PAUSE
goto restart:all
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
echo Exporting all levels logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat > ../Logcat_Output/[All-levels-Logcat].txt
cd "%~dp0"
goto stop:time
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
echo Exporting time-line logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat -v time -d > ../Logcat_Output/[Time-line-Logcat].txt
cd "%~dp0"
goto stop:neat
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
echo Exporting Neat logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat -v long > ../Logcat_Output/[Neat-Logcat].txt
cd "%~dp0"
goto stop:error
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
echo Exporting error level logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat *:E -v long > ../Logcat_Output/[Error-level-Logcat].txt
cd "%~dp0"
goto stop:fatal
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
echo Exporting fatal level logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat *:F -v long > ../Logcat_Output/[Fatal-level-Logcat].txt
cd "%~dp0"
goto stop:Nradio
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
echo Exporting All levels Radio logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat -b radio -v time -d > ../Logcat_Output/[All-levels-Radio-Logcat].txt
cd "%~dp0"
goto stop:Eradio
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
echo Exporting Error level Radio logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat -b radio *:E -v time -d > ../Logcat_Output/[Error-level-Radio-Logcat].txt
cd "%~dp0"
goto stop:Fradio
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
echo Exporting Fatal level Radio logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat -b radio *:F -v time -d > ../Logcat_Output/[Fatal-level-Radio-Logcat].txt
cd "%~dp0"
goto stop:stop
echo ADB logcat exporting is running now...
echo To stop exporting, press ENTER key..
set /P INPUT0=Stop Now: %=% > nul
IF "%INPUT0%"=="" (call :YStop)
:YStop
echo logcat has been stopped..
goto OpenOutput:OpenOutput
echo.
echo Open Logcat_Output folder? (any letter for YES, n or no for NO)
set /P INPUT=Make your choice: %=%
IF "%INPUT%"=="" (call :YOpenOutput)
IF %INPUT%==n (call :NOpenOutput)
IF %INPUT%==no (call :NOpenOutput)
IF %INPUT%==nO (call :NOpenOutput)
IF %INPUT%==N (call :NOpenOutput)
IF %INPUT%==No (call :NOpenOutput)
IF %INPUT%==NO (call :NOpenOutput)
:YOpenOutput
cd %~dp0/tools
adb kill-server
adb kill-server
cd "%~dp0"
cd %~dp0/Logcat_Output
IF EXIST "[All-levels-Logcat].txt" (REN "[All-levels-Logcat].txt" "[All-levels-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Time-line-Logcat].txt" (REN "[Time-line-Logcat].txt" "[Time-line-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Neat-Logcat].txt" (REN "[Neat-Logcat].txt" "[Neat-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Error-level-Logcat].txt" (REN "[Error-level-Logcat].txt" "[Error-level-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Fatal-level-Logcat].txt" (REN "[Fatal-level-Logcat].txt" "[Fatal-level-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[All-levels-Radio-Logcat].txt" (REN "[All-levels-Radio-Logcat].txt" "[All-levels-Radio-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Error-level-Radio-Logcat].txt" (REN "[Error-level-Radio-Logcat].txt" "[Error-level-Radio-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Fatal-level-Radio-Logcat].txt" (REN "[Fatal-level-Radio-Logcat].txt" "[Fatal-level-Radio-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
start "" "%~dp0/Logcat_Output"
echo.
echo Re-activating ADB Shell, Please Wait...
set appname=None
goto restart
:NOpenOutput
cd %~dp0/tools
adb kill-server
adb kill-server
cd "%~dp0"
cd %~dp0/Logcat_Output
IF EXIST "[All-levels-Logcat].txt" (REN "[All-levels-Logcat].txt" "[All-levels-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Time-line-Logcat].txt" (REN "[Time-line-Logcat].txt" "[Time-line-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Neat-Logcat].txt" (REN "[Neat-Logcat].txt" "[Neat-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Error-level-Logcat].txt" (REN "[Error-level-Logcat].txt" "[Error-level-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Fatal-level-Logcat].txt" (REN "[Fatal-level-Logcat].txt" "[Fatal-level-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[All-levels-Radio-Logcat].txt" (REN "[All-levels-Radio-Logcat].txt" "[All-levels-Radio-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Error-level-Radio-Logcat].txt" (REN "[Error-level-Radio-Logcat].txt" "[Error-level-Radio-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Fatal-level-Radio-Logcat].txt" (REN "[Fatal-level-Radio-Logcat].txt" "[Fatal-level-Radio-Logcat]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
echo.
echo Re-activating ADB Shell, Please Wait...
set appname=None
goto restart:fileselect
cls
echo.
echo            -----------------------------------------------------------
echo                         Please select a file from the list
echo                             bellow to view its content
echo            -----------------------------------------------------------
echo.
set /A count=0
FOR %%F IN (Logcat_Output/*.txt) DO (
set /A count+=1
set a!count!=%%F
if /I !count! LEQ 9 (echo ^- !count!  - %%F )
if /I !count! GTR 9 (echo ^- !count! - %%F )
)
FOR %%F IN (Logcat_Output/*.xml) DO (
set /A count+=1
set a!count!=%%F
if /I !count! LEQ 9 (echo ^- !count!  - %%F )
if /I !count! GTR 9 (echo ^- !count! - %%F )
)
echo.
echo.
echo           (Any other number or letter to return back to the main menu..)
echo       ----------------------------------------------------------------------
set /P INPUT1=Please Enter The File Number: %=%
if /I %INPUT1% GTR !count! (goto non)
if /I %INPUT1% LSS 1 (goto non)
set txts=!a%INPUT1%!
set jar=0
set ext=jar
IF "!txts:%ext%=!" NEQ "%txts%" set jar=1
cd "%~dp0"
start "" "%~dp0/Logcat_Output/%txts%"
cd "%~dp0"
goto restart
:non
goto restart:clean
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output
echo.
echo A cleaned Logcat_Output folder is created..
echo.
PAUSE
goto restart
)
echo.
echo Cleaning Logcat_Output folder..
cd %~dp0/tools
adb kill-server > nul
adb kill-server > nul
adb kill-server > nul
cd "%~dp0"
rmdir /S /Q Logcat_Output > nul
mkdir Logcat_Output
echo.
echo Cleaned..
echo Re-activating ADB Shell, Please Wait...
echo.
timeout 0 > nul
goto restart:restart1
cd "%~dp0"
cd %~dp0/tools
%model% > nul
IF %ERRORLEVEL% NEQ 0 (goto adberror)
cd "%~dp0"
set appname=None
goto MainMenu1:MainMenu1
COLOR 0E
cls
echo Date: %date%
echo Time: %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
cd %~dp0/tools
set /p "=Device ID: " <nul
%model%
cd "%~dp0"
echo.
echo  --------------------------------------------------------------------------------
echo.
echo                          Process Logcat Filtered By Name
echo.
echo  --------------------------------------------------------------------------------
echo  --------------------------------------------------------------------------------
ECHO  ^| Process Name To Filter: %appname% ^|
echo  --------------------------------------------------------------------------------
echo.
echo              0   Type a Process Name to Filter
ECHO.
echo              1   Export Normal All levels Filtered logcat to txt file
echo              2   Export Only Error level Filtered logcat to txt file
echo              3   Export Only Fatal level Filtered logcat to txt file
echo.
echo              4   Export All levels Filtered Radio logcat to txt file
echo              5   Export Error level Filtered Radio logcat to txt file
echo              6   Export Fatal level Filtered Radio logcat to txt file
ECHO.
echo              7   Return Back To The Main Menu
echo.
echo  --------------------------------------------------------------------------------
ECHO.
SET /P menuf=Please make your decision:
IF %menuf%==0 (goto filtername)
IF %menuf%==1 (goto filterall)
IF %menuf%==2 (goto filtererror)
IF %menuf%==3 (goto filterfatal)
IF %menuf%==4 (goto filterradio)
IF %menuf%==5 (goto filterErradio)
IF %menuf%==6 (goto filterFatradio)
IF %menuf%==7 (goto restart)@REM If you got here, it wasn't 0, 1, 2, 3, 4, 5, 6, or 7
echo.
echo.
ECHO                 *************************************************
echo                 *    Are you crazy.. choose something exist.    *
ECHO                 *************************************************
echo.
echo.
PAUSE
set appname=None
goto restart1:filtername
ECHO.
set /P newname=Type the process name to filter: %=%
set appname=%newname%
if "%newname%"=="" (goto ss1)
if "%newname%"==" " (goto ss1)
if "%newname%"=="  " (goto ss1)
if "%newname%"=="   " (goto ss1)
if "%newname%"=="    " (goto ss1)
if "%newname%"=="     " (goto ss1)
if "%newname%"=="      " (goto ss1)
if "%newname%"=="       " (goto ss1)
if "%newname%"=="        " (goto ss1)
if "%newname%"=="         " (goto ss1)
if "%newname%"=="          " (goto ss1)
if "%newname%"=="           " (goto ss1)
if "%newname%"=="            " (goto ss1)
if "%newname%"=="             " (goto ss1)
if "%newname%"=="              " (goto ss1)
if "%newname%"=="               " (goto ss1)
if "%newname%"=="                " (goto ss1)
if "%newname%"=="                 " (goto ss1)
if "%newname%"=="                  " (goto ss1)
if "%newname%"=="                   " (goto ss1)
if "%newname%"=="                    " (goto ss1)
if "%newname%"=="                     " (goto ss1)
if "%newname%"=="                      " (goto ss1)
if "%newname%"=="                       " (goto ss1)
if "%newname%"=="                        " (goto ss1)
if "%newname%"=="                         " (goto ss1)
if "%newname%"=="                          " (goto ss1)
if "%newname%"=="                           " (goto ss1)
if "%newname%"=="                            " (goto ss1)
if "%newname%"=="                             " (goto ss1)
if "%newname%"=="                              " (goto ss1)
goto MainMenu1:filterall
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
if %appname%==None goto ss
echo Exporting all levels %appname% filtered logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat %appname% *:S -v long > ../Logcat_Output/[All-levels-Logcat-filtered].txt
cd "%~dp0"
goto stop1:filtererror
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
if %appname%==None goto ss
echo Exporting %appname% filtered error level logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat %appname%:E *:S -v long > ../Logcat_Output/[Error-level-Logcat-filtered].txt
cd "%~dp0"
goto stop1:filterfatal
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
if %appname%==None goto ss
echo Exporting %appname% filtered fatal level logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat %appname%:F *:S -v long > ../Logcat_Output/[Fatal-level-Logcat-filtered].txt
cd "%~dp0"
goto stop1:filterradio
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
if %appname%==None goto ss
echo Exporting All levels %appname% filtered Radio logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat -b radio %appname% *:S -v time -d > ../Logcat_Output/[All-levels-Radio-Logcat-filtered].txt
cd "%~dp0"
goto stop1:filterErradio
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
if %appname%==None goto ss
echo Exporting %appname% filtered Error level Radio logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat -b radio %appname%:E *:S -v time -d > ../Logcat_Output/[Error-level-Radio-Logcat-filtered].txt
cd "%~dp0"
goto stop1:filterFatradio
if not exist %~dp0\Logcat_Output\ (mkdir Logcat_Output)
echo.
if %appname%==None goto ss
echo Exporting %appname% filtered Fatal level Radio logcat,,,
echo.
cd %~dp0/tools
start /b adb logcat -b radio %appname%:F *:S -v time -d > ../Logcat_Output/[Fatal-level-Radio-Logcat-filtered].txt
cd "%~dp0"
goto stop1:ss
echo.
echo.
ECHO         *****************************************************************
echo         *      Please Type A Process Name To Logcat It. (Option 0)      *
ECHO         *****************************************************************
echo.
echo.
PAUSE
goto restart1:ss1
echo.
echo.
ECHO         *****************************************************************
echo         * You Haven't Type Anything,, Please Type A Valid Process Name. *
ECHO         *****************************************************************
echo.
echo.
pause
goto restart1:stop1
echo ADB logcat exporting is running now...
echo To stop exporting, press ENTER key..
set /P INPUTS=Stop Now: %=% > nul
IF "%INPUTS%"=="" (call :YStop1)
:YStop1
echo logcat has been stopped..
goto OpenOutput1:OpenOutput1
echo.
echo Open Logcat_Output folder? (any letter for YES, n or no for NO)
set /P INPUTS1=Make your choice: %=%
IF "%INPUTS1%"=="" (call :YOpenOutput1)
IF %INPUTS1%==n (call :NOpenOutput1)
IF %INPUTS1%==no (call :NOpenOutput1)
IF %INPUTS1%==nO (call :NOpenOutput1)
IF %INPUTS1%==N (call :NOpenOutput1)
IF %INPUTS1%==No (call :NOpenOutput1)
IF %INPUTS1%==NO (call :NOpenOutput1)
:YOpenOutput1
cd %~dp0/tools
adb kill-server
adb kill-server
cd "%~dp0"
cd %~dp0/Logcat_Output
IF EXIST "[All-levels-Logcat-filtered].txt" (REN "[All-levels-Logcat-filtered].txt" "[All-levels-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[All-levels-Radio-Logcat-filtered].txt" (REN "[All-levels-Radio-Logcat-filtered].txt" "[All-levels-Radio-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Error-level-Logcat-filtered].txt" (REN "[Error-level-Logcat-filtered].txt" "[Error-level-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Fatal-level-Logcat-filtered].txt" (REN "[Fatal-level-Logcat-filtered].txt" "[Fatal-level-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Error-level-Radio-Logcat-filtered].txt" (REN "[Error-level-Radio-Logcat-filtered].txt" "[Error-level-Radio-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Fatal-level-Radio-Logcat-filtered].txt" (REN "[Fatal-level-Radio-Logcat-filtered].txt" "[Fatal-level-Radio-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
start "" "%~dp0/Logcat_Output"
echo.
echo Re-activating ADB Shell, Please Wait...
set appname=None
goto restart1
:NOpenOutput1
cd %~dp0/tools
adb kill-server
adb kill-server
cd "%~dp0"
cd %~dp0/Logcat_Output
IF EXIST "[All-levels-Logcat-filtered].txt" (REN "[All-levels-Logcat-filtered].txt" "[All-levels-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[All-levels-Radio-Logcat-filtered].txt" (REN "[All-levels-Radio-Logcat-filtered].txt" "[All-levels-Radio-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Error-level-Logcat-filtered].txt" (REN "[Error-level-Logcat-filtered].txt" "[Error-level-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Fatal-level-Logcat-filtered].txt" (REN "[Fatal-level-Logcat-filtered].txt" "[Fatal-level-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Error-level-Radio-Logcat-filtered].txt" (REN "[Error-level-Radio-Logcat-filtered].txt" "[Error-level-Radio-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
IF EXIST "[Fatal-level-Radio-Logcat-filtered].txt" (REN "[Fatal-level-Radio-Logcat-filtered].txt" "[Fatal-level-Radio-Logcat-(%appname%)-filtered]_%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.txt")
echo.
echo Re-activating ADB Shell, Please Wait...
set appname=None
goto restart1:restart2
cd "%~dp0"
cd %~dp0/tools
%model% > nul
IF %ERRORLEVEL% NEQ 0 (goto adberror)
cd "%~dp0"
set appname=None
goto MainMenu2:MainMenu2
COLOR 0E
cls
echo Date: %date%
echo Time: %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
cd %~dp0/tools
set /p "=Device ID: " <nul
%model%
cd "%~dp0"
echo.
echo  --------------------------------------------------------------------------------
echo.
echo                 Advanced Kernel Logcat (SU PERMISSIONS IS NEEDED!)
echo.
echo  --------------------------------------------------------------------------------
ECHO   PLEASE, ACCEPT / GUARANTEE SU ROOT ACCESS PERMISSIONS IF PROMPT IN YOUR DEVICE
echo  --------------------------------------------------------------------------------
echo.
echo              1  Read Only Kernel contineous message logcat (kmsg)
echo              2  Read Only Kernel last message logcat (last_kmsg)
echo              3  Read Only Kernel buffer message logcat (dmesg)
ECHO.
echo              4  Export Kernel contineous message logcat (kmsg) to Output folder
echo              5  Export Kernel last message logcat (last_kmsg) to Output folder
echo              6  Export Kernel buffer message logcat (dmesg) to Output folder
ECHO.
echo              7  Return Back To The Main Menu
echo.
echo  --------------------------------------------------------------------------------
echo.
SET /P menuk=Please make your decision:
IF %menuk%==1 (goto kmsg)
IF %menuk%==2 (goto lastkmsg)
IF %menuk%==3 (goto dmesg)
IF %menuk%==4 (goto Exkmsg)
IF %menuk%==5 (goto Exlastkmsg)
IF %menuk%==6 (goto Exdmesg)
IF %menuk%==7 (goto restart)@REM If you got here, it wasn't 1, 2, 3, 4, 5, 6, or 7
echo.
echo.
ECHO                 *************************************************
echo                 *    Are you crazy.. choose something exist.    *
ECHO                 *************************************************
echo.
echo.
PAUSE
goto restart2:kmsg
cd "%~dp0/tools"
Start "Reading kmsg log.. (To hold, press Ctrl + C).." suscript 1
goto restart2:lastkmsg
cd "%~dp0/tools"
Start "Reading last_kmsg log.." suscript 2
goto restart2:dmesg
cd "%~dp0/tools"
Start "Reading dmesg log.." suscript 3
goto restart2:Exkmsg
cd "%~dp0/tools"
adb shell "mkdir /sdcard/KERNEL_LOGS" > nul
Start "Exporting Kernel contineous message (kmsg) log.." suscript 4
goto restart2:Exlastkmsg
cd "%~dp0/tools"
adb shell "mkdir /sdcard/KERNEL_LOGS" > nul
Start "Exporting Kernel last message (last_kmsg) log.." suscript 5
goto restart2:Exdmesg
cd "%~dp0/tools"
adb shell "mkdir /sdcard/KERNEL_LOGS" > nul
Start "Exporting Kernel buffer message (dmesg) log.." suscript 6
goto restart2:termexit
cd %~dp0/tools
adb kill-server > nul
adb kill-server > nul
adb kill-server > nul
cd "%~dp0"
echo.
echo.
echo Bye Bye, see ya later :-)
echo.
timeout 3
EXIT:adberror
cls
COLOR 0C
ECHO.
ECHO.
ECHO.
echo  An Error Occured..
ECHO.
echo  ADB Failed Recognizing Your Device...
ECHO.
ECHO.
ECHO.
ECHO.
ECHO                **************************************************
echo                *                                                *
echo                * You Have Violated The Previous Requirements..  *
echo                *                                                *
ECHO                * Make Sure You Fulfilled All Requirements..     *
echo                *                                                *
ECHO                **************************************************
echo.
ECHO.
ECHO.
echo.
echo  Deactivating ADB Shell.. Please Wait..
cd %~dp0/tools
adb kill-server > nul
adb kill-server > nul
adb kill-server > nul
cd "%~dp0"
echo.
ECHO.
ECHO.
echo.
echo  Quitting Now...
ECHO.
ECHO.
ECHO                **************************************************
ECHO                *        Come again once you are ready...        *
ECHO                **************************************************
ECHO.
ECHO.
ECHO.
timeout 10
EXIT

3-2,设置快捷方式(不是必须的)

这一步只是为了方便,你完全可以点上一级目录中的 .bat 文件。

因为Log要出力到这里来,所以我弄了一个快捷方式到这里,这样我用的时候直接打开这个文件夹,就可以直接看到Log了,省了文件夹的切换。

3-3,获取Log

好了,准备工作都做好了,开始获取Android手机的Log吧。

1),双击打开bat文件

这一步只是显示欢迎信息而已,没有其他用途。

直接按下Enter按钮

说明为了获取Android手机的Log,所需的前提。

咱们直接按下Enter按钮继续

这里是说要启动ADB Shell,其实就是咱们平常所知的那些命令,在这里都自动干了。

2),选择获取Log的选项

 如果你按照我上面所说都设定好了,那你应该能来到下面的画面。

这里有很多选项,我平常用的是 1 - Export Normal All level logcat to txt file。

你可以研究研究其他选项。

直接按下 1

这样工具就开始从Android手机抓取Log了。

然后你就可以去操作手机,操作手机所产生的Log就都会记录下来,出力到PC上。

3),确认获取的Log

获取Log之后,直接按下Enter按钮,或者直接点 x 关掉该窗口。

Log大概就是下面这样的。

以上就是通过Logcat Manager获取Android手机的过程。

希望能给大家一些帮助,谢谢阅读!

工具你在网上自己找找应该也能找到,

我也上传到CSDN上面了,欢迎大家下载(3个积分)。

实在没有积分的朋友,请在本贴留言,我个别给你发。

https://download.csdn.net/download/shi_ly/90312915

更多内容请参照东京老树根博客主页

东京老树根-CSDN博客

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/68396.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

c++学习第十三天

创作过程中难免有不足&#xff0c;若您发现本文内容有误&#xff0c;恳请不吝赐教。 提示&#xff1a;以下是本篇文章正文内容&#xff0c;下面案例可供参考 一、vector 1.介绍 1. vector是表示可变大小数组的序列容器。 2. 就像数组一样&#xff0c;vector也采用的连续存储空…

「数学::质数」分解质因子 / LeetCode 2521(C++)

概述 由算数基本定理&#xff0c;我们知道任意一个大于1的自然数可以表示为一些质数的乘积&#xff1a; LeetCode 2521&#xff1a; 给你一个正整数数组 nums &#xff0c;对 nums 所有元素求积之后&#xff0c;找出并返回乘积中 不同质因数 的数目。 注意&#xff1a; 质数 是…

docker-compose Zookeeper 集群搭建

文章目录 前言docker-compose Zookeeper 集群搭建1. Zookeeper下载2. 制作Dockerfile文件3. 构建镜像4. docker-compose 管理5. docker-compose构建/启动6. 验证6.1 docker ps6.2 使用 zkCli.sh 连接并验证集群 前言 如果您觉得有用的话&#xff0c;记得给博主点个赞&#xff0…

WIN11 UEFI漏洞被发现, 可以绕过安全启动机制

近日&#xff0c;一个新的UEFI漏洞被发现&#xff0c;可通过多个系统恢复工具传播&#xff0c;微软已经正式将该漏洞标记为追踪编号“CVE-2024-7344”。根据报告的说明&#xff0c;该漏洞能让攻击者绕过安全启动机制&#xff0c;并部署对操作系统隐形的引导工具包。 据TomsH…

R语言学习笔记之高效数据操作

一、概要 数据操作是R语言的一大优势&#xff0c;用户可以利用基本包或者拓展包在R语言中进行复杂的数据操作&#xff0c;包括排序、更新、分组汇总等。R数据操作包&#xff1a;data.table和tidyfst两个扩展包。 data.table是当前R中处理数据最快的工具&#xff0c;可以实现快…

【数据结构】 并查集 + 路径压缩与按秩合并 python

目录 前言模板朴素实现路径压缩按秩合并按树高为秩按节点数为秩 总结 前言 并查集的基本实现通常使用森林来表示不同的集合&#xff0c;每个集合用一棵树表示&#xff0c;树的每个节点有一个指向其父节点的指针。 如果一个节点是它自己的父节点&#xff0c;那么它就是该集合的代…

低代码系统-产品架构案例介绍、得帆云(八)

产品名称 得帆云DeCode低代码平台-私有化 得帆云DeMDM主数据管理平台 得帆云DeCode低代码平台-公有云 得帆云DePortal企业门户 得帆云DeFusion融合集成平台 得帆云DeHoop数据中台 名词 概念 云原生 指自己搭建的运维平台&#xff0c;区别于阿里云、腾讯云 Dehoop 指…

【PyTorch】5.张量索引操作

目录 1. 简单行、列索引 2. 列表索引 3. 范围索引 4. 布尔索引 5. 多维索引 个人主页&#xff1a;Icomi 在深度学习蓬勃发展的当下&#xff0c;PyTorch 是不可或缺的工具。它作为强大的深度学习框架&#xff0c;为构建和训练神经网络提供了高效且灵活的平台。神经网络作为…

基于微信小程序高校课堂教学管理系统 课堂管理系统微信小程序(源码+文档)

目录 一.研究目的 二.需求分析 三.数据库设计 四.系统页面展示 五.免费源码获取 一.研究目的 困扰管理层的许多问题当中,高校课堂教学管理也是不敢忽视的一块。但是管理好高校课堂教学又面临很多麻烦需要解决,如何在工作琐碎,记录繁多的情况下将高校课堂教学的当前情况反…

论文阅读笔记:VMamba: Visual State Space Model

论文阅读笔记&#xff1a;VMamba: Visual State Space Model 1 背景2 创新点3 方法4 模块4.1 2D选择性扫描模块&#xff08;SS2D&#xff09;4.2 加速VMamba 5 效果5.1 和SOTA方法对比5.2 SS2D和自注意力5.3 有效感受野5.4 扫描模式 论文&#xff1a;https://arxiv.org/pdf/240…

【文星索引】搜索引擎项目测试报告

目录 一、项目背景二、 项目功能2.1 数据收集与索引2.2 API搜索功能2.3 用户体验与界面设计2.4 性能优化与维护 三、测试报告3.1 功能测试3.2 界面测试3.3 性能测试3.4 兼容性测试3.5 自动化测试 四、测试总结4.1 功能测试方面4.2 性能测试方面4.3 用户界面测试方面 一、项目背…

DBO-高斯回归预测matlab

蜣螂优化算法(Dung Beetle Optimizer, DBO)是一种新型的群智能优化算法&#xff0c;在2022年底提出&#xff0c;主要是受蜣螂的的滚球、跳舞、觅食、偷窃和繁殖行为的启发。 本次研究使用的是 Excel 格式的股票预测数据。数据集按照 8&#xff1a;1&#xff1a;1 的比例&#x…

java后端之事务管理

Transactional注解&#xff1a;作用于业务层的方法、类、接口上&#xff0c;将当前方法交给spring进行事务管理&#xff0c;执行前开启事务&#xff0c;成功执行则提交事务&#xff0c;执行异常回滚事务 spring事务管理日志&#xff1a; 默认情况下&#xff0c;只有出现Runti…

【嵌入式】总结——Linux驱动开发(三)

鸽了半年&#xff0c;几乎全忘了&#xff0c;幸亏前面还有两篇总结。出于快速体验嵌入式linux的目的&#xff0c;本篇与前两篇一样&#xff0c;重点在于使用、快速体验&#xff0c;uboot、linux、根文件系统不作深入理解&#xff0c;能用就行。 重新梳理一下脉络&#xff0c;本…

RabbitMQ 多种安装模式

文章目录 前言一、Windows 安装 RabbitMq1、版本关系2、Erlang2.1、下载安装 Erlang 23.12.2、配置 Erlang 环境变量 3、RabbitMQ3.1、下载安装 RabbitMQ 3.8.93.2、环境变量3.3、启动RabbitMQ 管理插件3.3、RabbitMQ3.4、注意事项 二、安装docker1、更新系统包&#xff1a;2、…

使用python-docx包进行多文件word文字、字符批量替换

1、首先下载pycharm。 2、改为中文。 3、安装python-docx包。 搜索包名字&#xff0c;安装。 4、新建py文件&#xff0c;写程序。 from docx import Documentdef replace1(array1):# 替换词典&#xff08;标签值按实际情况修改&#xff09;dic {替换词1: array1[0], 替换…

Android中Service在新进程中的启动流程

目录 1、Service与AMS交互框架介绍 1.1、认识AMS代表IActivityManager 1.2、认识客户端代表IApplicationThread 2、Service启动流程概览 我们知道Android有四大组件&#xff0c;Activity、Service、ContentProvider、Broadcast&#xff0c;每个组件在系统运行中或者我们编写…

read+write实现:链表放到文件+文件数据放到链表 的功能

思路 一、 定义链表&#xff1a; 1 节点结构&#xff08;数据int型&#xff09; 2 链表操作&#xff08;创建节点、插入节点、释放链表、打印链表&#xff09;。 二、链表保存到文件 1打开文件 2遍历链表、写文件&#xff1a; 遍历链表,write()将节点数据写入文件。…

【景区导游——LCA】

题目 代码 #include <bits/stdc.h> using namespace std; using ll long long; const int N 1e5 10; const int M 2 * N; int p[N][18], d[N], a[N]; ll dis[N][18]; //注意这里要开long long int h[N], e[M], ne[M], idx, w[M]; int n, k; void add(int a, int b, …

二进制安卓清单 binary AndroidManifest - XCTF apk 逆向-2

XCTF 的 apk 逆向-2 题目 wp&#xff0c;这是一道反编译对抗题。 题目背景 AndroidManifest.xml 在开发时是文本 xml&#xff0c;在编译时会被 aapt 编译打包成为 binary xml。具体的格式可以参考稀土掘金 MindMac 做的类图&#xff08;2014&#xff09;&#xff0c;下面的博…