Skip to content

Commit

Permalink
Add logging to file
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammy1Am committed May 2, 2018
1 parent f85383f commit 0a2eab2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Log file
*.log
*.log.*

# BlueJ files
*.ctxt
Expand All @@ -23,10 +24,12 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

#NetBeans Temp Files
/Java/MoppyLib/.nb-gradle/
/Java/MoppyLib/build/
/Java/MoppyDeviceGUI/.nb-gradle/
/Java/MoppyDeviceGUI/build/
/Java/*/.nb-gradle-properties
/Java/MoppyControlGUI/.nb-gradle/
/Java/MoppyControlGUI/build/
/Java/MoppyControlGUI/build/
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
import com.moppy.core.midi.MoppyMIDISequencer;
import com.moppy.core.status.StatusBus;
import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import javax.sound.midi.MidiUnavailableException;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
Expand All @@ -22,6 +25,14 @@ public class MoppyControlGUI {
*/
public static void main(String[] args) throws IOException, MidiUnavailableException {

//
//// Initialize Logger
//

FileHandler logFileHandler = new FileHandler("moppy_control_gui.log", 5000000, 3, true);
logFileHandler.setFormatter(new SimpleFormatter());
LogManager.getLogManager().getLogger("").addHandler(logFileHandler);

//
//// Initialize Moppy System components
//
Expand Down

0 comments on commit 0a2eab2

Please sign in to comment.