---
title: "Writing events to log text file using java"  
description: "Writing events to log text file using java"  
author: "Kate Smith"  
published: 2013-10-05  
updated: 2013-10-05  
canonical: https://www.mindstick.com/forum/1622/writing-events-to-log-text-file-using-java  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# Writing events to log text file using java

The below line of [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to write the [events](https://www.mindstick.com/blog/102/events-in-c-sharp) in a [log](https://www.mindstick.com/articles/126269/the-main-uses-of-log-cabins) [file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp) but no file is being created and I am also not getting any kind of [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing) at all.

## My log [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp):

```
public class Logs {
static FileHandler fileTxt;
static SimpleFormatter formatterTxt;
static public void logging() throws IOException {
    Logger logger = Logger.getLogger("");
    logger.setLevel(Level.INFO);
    fileTxt = new FileHandler("c:/SimleTaskEvents.txt");
    formatterTxt = new SimpleFormatter();
    fileTxt.setFormatter(formatterTxt);
    logger.addHandler(fileTxt);
}
}
```

\

## Replies

### Reply by Hank Greenberg

You should write to the log first logger.info("my logging line");


---

Original Source: https://www.mindstick.com/forum/1622/writing-events-to-log-text-file-using-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
