loggers... still don't work
This commit is contained in:
parent
20677a82e6
commit
f6bb8e553b
@ -7,10 +7,19 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library" exported="">
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../log4j-api-2_22_0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/Downloads/apache-log4j-2.22.0-bin/log4j-core-2.22.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/Downloads/apache-log4j-2.22.0-bin/log4j-api-2.22.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
@ -12,7 +12,6 @@ import org.apache.logging.log4j.*;
|
||||
|
||||
public class FormLocomotiveCollections {
|
||||
private final Logger _logger;
|
||||
|
||||
FormElectricLocomotive formElectricLocomotive;
|
||||
FormLocomotiveConfig formLocomotiveConfig;
|
||||
private JPanel MainPanel;
|
||||
@ -60,8 +59,8 @@ public class FormLocomotiveCollections {
|
||||
}
|
||||
_storage.AddSet(NameStorage);
|
||||
ReloadObjects();
|
||||
_logger.info("Добавлен набор: " + NameStorage);
|
||||
Refresh();
|
||||
_logger.info("Добавлен набор: " + NameStorage);
|
||||
});
|
||||
|
||||
ButtonRemoveObject.addActionListener(e ->
|
||||
@ -72,6 +71,7 @@ public class FormLocomotiveCollections {
|
||||
JOptionPane.showMessageDialog(this.getPictureBoxCollections(), "Коллекция удалена", "Удаление", JOptionPane.INFORMATION_MESSAGE);
|
||||
_storage.DelSet((String) listBoxStorage.getSelectedValue()); //ТУТ СТРИНГ ОБРАТИ ВНИМАНИЕ КАК-НИБУДЬ
|
||||
ReloadObjects();
|
||||
_logger.info("Удален набор: " );
|
||||
});
|
||||
|
||||
ButtonAddLocomotive.addActionListener(e -> {
|
||||
|
@ -3,12 +3,18 @@ package ProjectElectricLocomotive;
|
||||
import org.apache.logging.log4j.*;
|
||||
|
||||
public class Main {
|
||||
private static Logger logger = LogManager.getLogger(Main.class);
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.setProperty("log4j.configutationFile", "C:\\code\\java\\ProjectElectricLocomotive\\loggerFile.xml");
|
||||
System.setProperty("log4j.configurationFile", "C:\\code\\java\\ProjectElectricLocomotive\\loggerFile.xml");
|
||||
|
||||
// new FrameLocomotiveCollection(LogManager.getLogger("logger"));
|
||||
FrameLocomotiveCollection frameLocomotiveCollection = new FrameLocomotiveCollection(LogManager.getLogger("logger"));
|
||||
new FrameLocomotiveCollection(LogManager.getLogger("logger"));
|
||||
//FrameLocomotiveCollection frameLocomotiveCollection = new FrameLocomotiveCollection(LogManager.getLogger("logger"));
|
||||
// new FormLocomotiveCollections(LogManager.getLogger(FormLocomotiveCollections.class));
|
||||
|
||||
|
||||
logger.info("hello");
|
||||
|
||||
}
|
||||
}
|
||||
|
17
ProjectElectricLocomotive/log4j.properties
Normal file
17
ProjectElectricLocomotive/log4j.properties
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
# Root logger option
|
||||
log4j.rootLogger=DEBUG, stdout, file
|
||||
|
||||
# Redirect log messages to console
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
|
||||
# Redirect log messages to a log file, support file rolling.
|
||||
log4j.appender.file=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.file.File=C:\logs.log
|
||||
log4j.appender.file.MaxFileSize=5MB
|
||||
log4j.appender.file.MaxBackupIndex=10
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
Loading…
Reference in New Issue
Block a user