Search code examples
bashsearchloggingnullpointerexceptiontail

Search for NullPointerException in Log


Can anyone guide/paste a command to search for all NullPointerExceptions in a log file. As developers, we do watch logs for such issues and logs can be huge.

I am using bash and wants to find all NullPointerExceptions in log file, with above and below 10 lines, seperated by any specific design "------------------------------" like this.

Please, share it, much helpful, pretty newbie to *nix


Solution

  • You can try this grep,

    grep -A10 -B10 'NullPointerExceptions' your.log