/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.log4j.lf5.viewer;
import org.apache.log4j.lf5.LogLevel;
import org.apache.log4j.lf5.LogRecord;
import org.apache.log4j.lf5.LogRecordFilter;
import org.apache.log4j.lf5.util.DateFormatManager;
import org.apache.log4j.lf5.util.LogFileParser;
import org.apache.log4j.lf5.util.StreamUtils;
import org.apache.log4j.lf5.viewer.categoryexplorer.CategoryExplorerTree;
import org.apache.log4j.lf5.viewer.categoryexplorer.CategoryPath;
import org.apache.log4j.lf5.viewer.configure.ConfigurationManager;
import org.apache.log4j.lf5.viewer.configure.MRUFileManager;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import java.util.List;
/**
* LogBrokerMonitor
*.
* @author Michael J. Sikorsky
* @author Robert Shaw
* @author Brad Marlborough
* @author Richard Wan
* @author Brent Sprecher
* @author Richard Hurst
*/
// Contributed by ThoughtWorks Inc.
public class LogBrokerMonitor {
//--------------------------------------------------------------------------
// Constants:
//--------------------------------------------------------------------------
public static final String DETAILED_VIEW = "Detailed";
// public static final String STANDARD_VIEW = "Standard";
// public static final String COMPACT_VIEW = "Compact";
//--------------------------------------------------------------------------
// Protected Variables:
//--------------------------------------------------------------------------
protected JFrame _logMonitorFrame;
protected int _logMonitorFrameWidth = 550;
protected int _logMonitorFrameHeight = 500;
protected LogTable _table;
protected CategoryExplorerTree _categoryExplorerTree;
protected String _searchText;
protected String _NDCTextFilter = "";
protected LogLevel _leastSevereDisplayedLogLevel = LogLevel.DEBUG;
protected JScrollPane _logTableScrollPane;
protected JLabel _statusLabel;
protected Object _lock = new Object();
protected JComboBox _fontSizeCombo;
protected int _fontSize = 10;
protected String _fontName = "Dialog";
protected String _currentView = DETAILED_VIEW;
protected boolean _loadSystemFonts = false;
protected boolean _trackTableScrollPane = true;
protected Dimension _lastTableViewportSize;
protected boolean _callSystemExitOnClose = false;
protected List _displayedLogBrokerProperties = new Vector();
protected Map _logLevelMenuItems = new HashMap();
protected Map _logTableColumnMenuItems = new HashMap();
protected List _levels = null;
protected List _columns = null;
protected boolean _isDisposed = false;
protected ConfigurationManager _configurationManager = null;
protected MRUFileManager _mruFileManager = null;
protected File _fileLocation = null;
//--------------------------------------------------------------------------
// Private Variables:
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Constructors:
//--------------------------------------------------------------------------
/**
* Construct a LogBrokerMonitor.
*/
public LogBrokerMonitor(List logLevels) {
_levels = logLevels;
_columns = LogTableColumn.getLogTableColumns();
// This allows us to use the LogBroker in command line tools and
// have the option for it to shutdown.
String callSystemExitOnClose =
System.getProperty("monitor.exit");
if (callSystemExitOnClose == null) {
callSystemExitOnClose = "false";
}
callSystemExitOnClose = callSystemExitOnClose.trim().toLowerCase();
if (callSystemExitOnClose.equals("true")) {
_callSystemExitOnClose = true;
}
initComponents();
_logMonitorFrame.addWindowListener(
new LogBrokerMonitorWindowAdaptor(this));
}
//--------------------------------------------------------------------------
// Public Methods:
//--------------------------------------------------------------------------
/**
* Show the frame for the LogBrokerMonitor. Dispatched to the
* swing thread.
*/
public void show(final int delay) {
if (_logMonitorFrame.isVisible()) {
return;
}
// This request is very low priority, let other threads execute first.
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Thread.yield();
pause(delay);
_logMonitorFrame.setVisible(true);
}
});
}
public void show() {
show(0);
}
/**
* Dispose of the frame for the LogBrokerMonitor.
*/
public void dispose() {
_logMonitorFrame.dispose();
_isDisposed = true;
if (_callSystemExitOnClose == true) {
System.exit(0);
}
}
/**
* Hide the frame for the LogBrokerMonitor.
*/
public void hide() {
_logMonitorFrame.setVisible(false);
}
/**
* Get the DateFormatManager for formatting dates.
*/
public DateFormatManager getDateFormatManager() {
return _table.getDateFormatManager();
}
/**
* Set the date format manager for formatting dates.
*/
public void setDateFormatManager(DateFormatManager dfm) {
_table.setDateFormatManager(dfm);
}
/**
* Get the value of whether or not System.exit() will be called
* when the LogBrokerMonitor is closed.
*/
public boolean getCallSystemExitOnClose() {
return _callSystemExitOnClose;
}
/**
* Set the value of whether or not System.exit() will be called
* when the LogBrokerMonitor is closed.
*/
public void setCallSystemExitOnClose(boolean callSystemExitOnClose) {
_callSystemExitOnClose = callSystemExitOnClose;
}
/**
* Add a log record message to be displayed in the LogTable.
* This method is thread-safe as it posts requests to the SwingThread
* rather than processing directly.
*/
public void addMessage(final LogRecord lr) {
if (_isDisposed == true) {
// If the frame has been disposed of, do not log any more
// messages.
return;
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
_categoryExplorerTree.getExplorerModel().addLogRecord(lr);
_table.getFilteredLogTableModel().addLogRecord(lr); // update table
updateStatusLabel(); // show updated counts
}
});
}
public void setMaxNumberOfLogRecords(int maxNumberOfLogRecords) {
_table.getFilteredLogTableModel().setMaxNumberOfLogRecords(maxNumberOfLogRecords);
}
public JFrame getBaseFrame() {
return _logMonitorFrame;
}
public void setTitle(String title) {
_logMonitorFrame.setTitle(title + " - LogFactor5");
}
public void setFrameSize(int width, int height) {
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
if (0 < width && width < screen.width) {
_logMonitorFrameWidth = width;
}
if (0 < height && height < screen.height) {
_logMonitorFrameHeight = height;
没有合适的资源?快使用搜索试试~ 我知道了~
java apache-log4j-1.2.15
共1310个文件
html:741个
java:296个
xml:82个
需积分: 50 20 下载量 114 浏览量
2008-12-07
19:43:49
上传
评论
收藏 3.52MB ZIP 举报
温馨提示
用它可以开发出优秀的语言程序 ,apache-log4j-1.2.15.zip 解压后即可应用。。。。。。。。
资源推荐
资源详情
资源评论
收起资源包目录
java apache-log4j-1.2.15 (1310个子文件)
xmlLayout.1 5KB
dom.A1.1 4KB
patternLayout.1 4KB
dom.A2.1 3KB
socketServer.1 2KB
customLogger.1 941B
xmlLayout.mdc.1 296B
customLevel.1 210B
hierarchyThreshold.1 0B
patternLayout.10 6KB
patternLayout.11 5KB
patternLayout.12 6KB
patternLayout.13 6KB
patternLayout.14 4KB
xmlLayout.2 7KB
patternLayout.2 5KB
socketServer.2 2KB
xmlLayout.mdc.2 356B
customLevel.2 210B
hierarchyThreshold.2 51B
customLogger.2 47B
patternLayout.3 5KB
socketServer.3 2KB
xmlLayout.3 720B
hierarchyThreshold.3 102B
customLevel.3 42B
patternLayout.4 5KB
dom.A1.4 4KB
dom.A2.4 3KB
socketServer.4 2KB
customLevel.4 210B
hierarchyThreshold.4 152B
patternLayout.5 5KB
socketServer.5 2KB
hierarchyThreshold.5 202B
patternLayout.6 5KB
socketServer.6 2KB
hierarchyThreshold.6 253B
patternLayout.7 5KB
socketServer.7 2KB
hierarchyThreshold.7 304B
patternLayout.8 5KB
socketServer.8 2KB
hierarchyThreshold.8 304B
patternLayout.9 5KB
publications.apt 4KB
index.apt 3KB
download.apt 3KB
roadmap.apt 1KB
mycat.bad 1KB
run-tests.bat 7KB
exception.bin 2KB
mdc.bin 508B
location.bin 465B
ndc.bin 409B
simple.bin 399B
MSG00001.bin 164B
info.bin 60B
CONTENTS 3KB
nteventlog.cpp 8KB
maven-theme.css 3KB
maven-base.css 2KB
stylesheet.css 1KB
stylesheet.css 1KB
stylesheet.css 1KB
site.css 775B
site.css 775B
print.css 222B
NTEventLogAppender.dll 10KB
log4j.dtd 7KB
log4j.dtd 7KB
faq.fml 29KB
od.gif 6KB
od.gif 6KB
lf5_small_icon.gif 1KB
icon_help_sml.gif 1019B
icon_error_sml.gif 1010B
icon_success_sml.gif 990B
channelexplorer_new.gif 778B
icon_info_sml.gif 606B
icon_warning_sml.gif 576B
channelexplorer_satellite.gif 256B
remove.gif 227B
add.gif 207B
update.gif 192B
fix.gif 181B
inherit.gif 57B
collapsed.gif 53B
expanded.gif 52B
mycat.good 2KB
index-all.html 595KB
changes-report.html 147KB
LogBrokerMonitor.html 123KB
LogBrokerMonitor.html 94KB
DOMConfigurator.html 87KB
Category.html 82KB
Category.html 78KB
NOPLogger.html 70KB
PropertyConfigurator.html 59KB
manual.html 53KB
共 1310 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论
XINHAO11111111
- 粉丝: 0
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功