Классы исключений и подключение логера.

This commit is contained in:
Programmist73 2022-12-02 15:50:44 +04:00
parent 50c36f8838
commit a457ebefcb
7 changed files with 54 additions and 0 deletions

View File

@ -7,5 +7,14 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../../../log4j-1.2.17/apache-log4j-1.2.17/log4j-1.2.17.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component> </component>
</module> </module>

2
Project/SaveData.txt Normal file
View File

@ -0,0 +1,2 @@
MapsCollection
123|SimpleMap|1000:750:-256;

3
Project/logs.log Normal file
View File

@ -0,0 +1,3 @@
2022-12-02 15:37:35 INFO Main:17 - ШАЛОМ ЁМАНА :)))
2022-12-02 15:41:33 INFO Main:17 - ШАЛОМ ЁМАНА :)))
2022-12-02 15:42:13 INFO Main:17 - ШАЛОМ ЁМАНА :)))

View File

@ -1,3 +1,4 @@
import org.apache.log4j.Logger;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
@ -40,6 +41,9 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
//объект от коллекции карт //объект от коллекции карт
private final MapsCollection _mapsCollection; private final MapsCollection _mapsCollection;
//логгер
private static Logger logger = Logger.getLogger(Main.class);
//Для выпадающего списка //Для выпадающего списка
HashMap<String, AbstractMap> _mapsHashMap = new HashMap<>() HashMap<String, AbstractMap> _mapsHashMap = new HashMap<>()
{{ {{

View File

@ -0,0 +1,10 @@
public class PlaneNotFoundException extends Exception
{
public PlaneNotFoundException(int i) {super ("Не найден объект по позиции" + i); }
public PlaneNotFoundException() { super(); }
public PlaneNotFoundException(String message) { super(message); }
public PlaneNotFoundException(String message, Exception exception) { super(message, exception); }
}

View File

@ -0,0 +1,10 @@
public class StorageOverflowException extends Exception
{
public StorageOverflowException(int count) {super("В наборе превышено допустимое количество: " + count);}
public StorageOverflowException() { super(); }
public StorageOverflowException(String message) { super(message); }
public StorageOverflowException(String message, Exception exception) { super(message, exception); }
}

View File

@ -0,0 +1,16 @@
# Root logger option
log4j.rootLogger=INFO, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=C:\logs.log
log4j.appender.file.MaxFileSize=10MB
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
# Direct log messages to stdout
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