Here’s a simple tips on how to setup your Windows a SFTP server. Between, will also show the way to push to files from my Linux Ubuntu to the Windows as well. To kick start, I’ve downloaded MiniSFTP program for Windows. (1) Download MiniSFTP from this URL http://www.coreftp.com/server/download/msftpsrvr.exe (2) Double Click on the installer to run it. (3) Enter any username , password and the root path. Set the port [ Read More ]
Imagine having set your Glassfish logs to output the “finest”, you’ll be amazed with the space the logs consume. Glassfish server logs can be found @ <glassfish installation>/current/domains/domain1/logs folder In order to maintain the numbers of last files to be kept, you can do the following setting: (1) Access Glassfish admin. Default URL : http://localhost:4848 Default Username: admin Default Password: adminadmin (2) Go to : Glassfish Admin Console –> Application [ Read More ]
For some special case, you might need to write the log to Windows’ Event Log, To kick start, create a Class so that you can alwiz reuse the code when want to write to Event Log. In my case, I’ve created a Class called EventLogHelper: class EventLogHelper { public static void writeEventLog(String description) { String sSource; String sLog; sSource = “MyService”; sLog = “Application”; if (!EventLog.SourceExists(sSource)) { EventLog.CreateEventSource(sSource, sLog); } [ Read More ]
Here’s a short example on how to read from file and display it to a Label: private void readFile() { String fileName = “D://logs//general.log”; String textLine = “”; System.IO.StreamReader reader; reader= new System.IO.StreamReader(fileName); do { textLine = textLine + reader.ReadLine() + “\r\n”; } while (reader.Peek() != -1); lbl1Ouput.Text = textLine; reader.Close(); } But if the “general.log” is being written at the same time (at other program), then the example above [ Read More ]