[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[h-e-w] mode for viewing JBoss and WebLogic logs
From: |
Glen Cordrey |
Subject: |
[h-e-w] mode for viewing JBoss and WebLogic logs |
Date: |
Fri, 29 Oct 2004 08:27:06 -0400 |
Here's a mode I
wrote to make it easier to pick out errors in log files from WebLogic and JBoss.
I'm not an elisp expert, so
this may not need to be a mode nor may the mode be defined
complely
correct, but it
works well enough for me.
; Mode for fontifying JBoss and WebLogic log files.
; Warning lines are displayed in bold orange,
; error lines in bold red,
and 'Caused by' lines in exception traces are
; reverse videoed in
pink
;
; Author: Glen Cordrey 10/29/2004 address@hidden
; Version:
1.0
;
; Tested against
logs from JBoss 3.0.7 and WebLogic 7.0.4. Log lines to fontify
are
; selected via
regexps, so it should be easy to accomodate changes by simply
; modifying the
regexps.
;
; To use, in your
emacs load path create file log-mode.el containing this
text,
; then edit your
.emacs.el to contain
; (require 'log-mode)
; Any file with a
.log extension will then open in this mode
; allow hooks if anyone wants to add
them
(defvar log-mode-hook nil)
; use this mode for all filenames ending in .log
(add-to-list
'auto-mode-alist '("\\.log\\'" . log-mode))
; define some faces
(defgroup log-faces
nil
"Faces for log mode"
:group 'log)
(defface log-caused-by-face '((t (:background
"Pink")))
"Face used for Caused by lines in exceptions"
:group 'log-faces)
(defface log-warning-face '((t (:foreground
"Orange" :bold t) ))
"Face used for lines containing
warnings"
:group 'log-faces)
(defface log-error-face '((t (:foreground "Red"
:bold t) ))
"Face used for lines containing errors"
:group
'log-faces)
(defvar log-caused-by-face 'log-caused-by-face)
(defvar
log-warning-face 'log-warning-face)
(defvar log-error-face
'log-error-face)
; define strings whose presence in a line indicate that we want to
;
fontify the line
(defconst log-font-lock-keywords
(list
'(".*<Error>.*" 0 log-error-warning-face t)
'(".*<Warning>.*" 0 log-warning-face t)
'(".*ERROR.*" 0
log-error-face t)
'(".*WARN.*" 0 log-warning-face t)
'(".*Caused by.*" 0 log-caused-by-face t) )
"Highlighting for log
files" )
(defun log-mode ()
"Mode for viewing log files"
(interactive)
(kill-all-local-variables)
(set
(make-local-variable 'font-lock-defaults) '(log-font-lock-keywords))
(setq major-mode 'log-mode)
(setq mode-name
"LOG")
(run-hooks 'log-mode-hook))
(provide 'log-mode)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [h-e-w] mode for viewing JBoss and WebLogic logs,
Glen Cordrey <=