How to take logs via ADB on windows PC ?

1.Enable USB debugging in device.

2.Connect the device to a usb port.

3.Open command prompt.

4.To get logcat use following commands:

host $ adb logcat > filename.txt //stores in filename.txt in host pc

5.To get kernel message (kmsg)

host $ adb shell
device $ cat /proc/kmsg > filename.txt //stores kmsg in filename.txt in device.
device $ exit
host $ adb pull /data/filename.txt //pulls filename.txt from device to host pc.