diff --git a/log4j.xml b/log4j.xml new file mode 100644 index 0000000000000000000000000000000000000000..683715ae00e0c5c1e830f4107094b168cd269de7 --- /dev/null +++ b/log4j.xml @@ -0,0 +1,30 @@ +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> +<log4j:configuration debug="true"> + + <appender name="fileAppender" class="org.apache.log4j.RollingFileAppender"> + <param name="File" value="demoApplication.log"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" /> + </layout> + </appender> + + <logger name="org.hibernate.SQL" additivity="false"> + <level value="DEBUG" /> + <appender-ref ref="hibernate"/> + </logger> + + <category name="org.hibernate"> + <priority value="WARN" /> + </category> + + <category name="org.hibernate"> + <priority value="ERROR" /> + </category> + + <root> + <priority value="debug"/> + <appender-ref ref="console"/> + <appender-ref ref="fileAppender"/> + </root> + +</log4j:configuration> \ No newline at end of file diff --git a/pom.xml b/pom.xml index ffd38249d4c7f22d4440523073e4a768dbc8a1e4..b37f32468171ddd9cbf7303e793d78a704f22678 100644 --- a/pom.xml +++ b/pom.xml @@ -33,6 +33,12 @@ <version>11</version> </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.17</version> + </dependency> + <dependency> <groupId>com.lynden</groupId> <artifactId>GMapsFX</artifactId> @@ -56,11 +62,13 @@ <artifactId>hibernate-core</artifactId> <version>5.4.1.Final</version> </dependency> + <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>5.4.1.Final</version> </dependency> + <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-agroal</artifactId> diff --git a/src/App/Logger/MyLogger.java b/src/App/Logger/MyLogger.java new file mode 100644 index 0000000000000000000000000000000000000000..d7bc9b84f00ec199ef65b256ab9ba9636b80563e --- /dev/null +++ b/src/App/Logger/MyLogger.java @@ -0,0 +1,17 @@ +package Logger; + +import org.apache.log4j.Logger; +import org.apache.log4j.xml.DOMConfigurator; + +public class MyLogger { + static Logger logger = Logger.getLogger(MyLogger.class); + + public static void main(String[] args) + { + //DOMConfigurator is used to configure logger from xml configuration file + DOMConfigurator.configure("log4j.xml"); + + //Log in console in and log file + logger.debug("Log4j appender configuration is successful !!"); + } +} diff --git a/src/App/Scenes/MapScene.java b/src/App/Scenes/MapScene.java index 9ab6bb6b1e71f9fd2e2bf55613f3bb07ac33a3d1..26018aca4940163e372112f2c60399bcf71ee4a0 100644 --- a/src/App/Scenes/MapScene.java +++ b/src/App/Scenes/MapScene.java @@ -1,6 +1,7 @@ package Scenes; import Database.HibernateClasses.Picture; +import Logger.MyLogger; import com.lynden.gmapsfx.GoogleMapView; import com.lynden.gmapsfx.MapComponentInitializedListener; import com.lynden.gmapsfx.javascript.object.GoogleMap; @@ -19,7 +20,7 @@ import com.lynden.gmapsfx.javascript.object.MarkerOptions; this.setLayout(); } - //TODO: Make map visible + //TODO: Make logging stop @Override public void setLayout() { mapView = new GoogleMapView(); @@ -52,7 +53,7 @@ import com.lynden.gmapsfx.javascript.object.MarkerOptions; addPictureMarkers(); //Possible reason here, have to send in an array with pictures } - //TODO: Make pins show on the map + public void addPictureMarkers (Picture... pictures){ for (Picture p : pictures){ MarkerOptions markerOptions = new MarkerOptions();