Question: I have an ASP.NET MVC 2 web-site. All the buisnes is in the databse stored procedures (MS SQL SERVER 2008).  

The task:  

Some user creates record, using web-site. Appropriate row inserts into the table. This row has foreign key to another table, its value sets in the procedure. Then I want application to reassign record (change foreign key field) to another, if it was not handled during 1 minute.  

For example:  

1. User creates record `A(id = 1, adminId = 1)`.  

2. Only administrator with id=1 see this record and he should handle it during 1 minute.  

3. If admin 1 not handles record during 1 minute, it should be reassigned to another administrator. For example `A` updates to `(adminId = 3)`.  

Which way would be better to do this? Parallel thread? Another application in background? Or...

Answer: 
I ended up writing my own function for logging on the device. 

```
public static BufferedWriter out;
    private void createFileOnDevice(Boolean append) throws IOException {
            /*
             * Function to initially create the log file and it also writes the time of creation to file.
             */
            File Root = Environment.getExternalStorageDirectory();
            if(Root.canWrite()){
                 File  LogFile = new File(Root, "Log.txt");
                 FileWriter LogWriter = new FileWriter(LogFile, append);
                 out = new BufferedWriter(LogWriter);
                 Date date = new Date();
                 out.write("Logged at" + String.valueOf(date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() + "\n"));
            }
        }

public void writeToFile(String message){
        try {
            out.write(message+"\n");
        } catch (IOException e) {
            e.printStackTrace();
        }

```

The related question on SO is [here](https://stackoverflow.com/questions/5726519/creating-and-storing-log-file-on-device-in-android).
[Logcollector](http://code.google.com/p/android-log-collector/) is the option for you but you need to install it first on your device.

Again you can save the activity log via adb 

Run `adb shell logcat > your_log_file.txt` from your command prompt.