# WriteLog

Writes a message out to a log file

## Method Signature

```
WriteLog(text=[string], type=[string], application=[boolean], log=[string])
```

### Arguments

| Argument      | Type      | Required | Description                                                                                                                                                                                                                                                                        | Default |
| ------------- | --------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `text`        | `string`  | `true`   | The text of the log message                                                                                                                                                                                                                                                        |         |
| `type`        | `string`  | `false`  | The log level of the entry. One of "Information", "Warning", "Error", "Debug", "Trace"                                                                                                                                                                                             | `info`  |
| `application` | `boolean` | `false`  | If true, it logs the application name alongside the message. Default is true.                                                                                                                                                                                                      | `true`  |
| `log`         | `string`  | `false`  | <p>The destination logger to use. If not passed, we use the default logger (application.log).<br>If the logger is a file appender and it doesn't exist it will create it for you.<br>If the value is an absolue path, it will create a file appender for you at that location.</p> |         |

## Examples

### Simple writeLog Code Example

Logs an order processed successfully message to `orders.log` which will be located in the BX logs directory, eg: `{bx.root}/logs/`

```java
writeLog( text="Order #order.getOrderID()# Processed Successfully", type="information", log="orders" );

```

### Additional Examples

[Run Example](https://try.boxlang.io/?code=eJwrL8osSfXJT9dQyMlPt1XyrQSylXQUSlIrSmzz8ss1NIHsyoJUW6XUoqL8IiUFTWsuAMW8EHs%3D)

```java
writeLog( log="MyLog", text=now(), type="error" );

```

## Related

* [ApplicationRestart](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/applicationrestart)
* [ApplicationStartTime](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/applicationstarttime)
* [ApplicationStop](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/applicationstop)
* [BoxAnnounce](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/boxannounce)
* [BoxAnnounceAsync](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/boxannounceasync)
* [BoxAST](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/boxast)
* [BoxModuleReload](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/boxmodulereload)
* [BoxRegisterInterceptionPoints](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/boxregisterinterceptionpoints)
* [BoxRegisterInterceptor](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/boxregisterinterceptor)
* [BoxRegisterRequestInterceptor](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/boxregisterrequestinterceptor)
* [BoxUnregisterInterceptor](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/boxunregisterinterceptor)
* [BoxUnregisterRequestInterceptor](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/boxunregisterrequestinterceptor)
* [CallStackGet](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/callstackget)
* [CreateGUID](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/createguid)
* [CreateObject](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/createobject)
* [CreateUUID](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/createuuid)
* [DE](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/de)
* [DebugBoxContexts](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/debugboxcontexts)
* [Dump](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/dump)
* [Duplicate](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/duplicate)
* [echo](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/echo)
* [EncodeForHTML](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/encodeforhtml)
* [GetApplicationMetadata](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getapplicationmetadata)
* [GetBaseTagData](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getbasetagdata)
* [GetBaseTagList](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getbasetaglist)
* [GetBaseTemplatePath](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getbasetemplatepath)
* [GetBoxContext](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getboxcontext)
* [GetBoxRuntime](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getboxruntime)
* [GetBoxVersionInfo](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getboxversioninfo)
* [GetClassMetadata](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getclassmetadata)
* [GetComponentList](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getcomponentlist)
* [GetContextRoot](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getcontextroot)
* [GetCurrentTemplatePath](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getcurrenttemplatepath)
* [GetFileFromPath](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getfilefrompath)
* [GetFunctionCalledName](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getfunctioncalledname)
* [GetFunctionList](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getfunctionlist)
* [GetModuleInfo](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getmoduleinfo)
* [GetModuleList](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getmodulelist)
* [GetRequestClassLoader](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getrequestclassloader)
* [GetSemver](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getsemver)
* [GetSystemSetting](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getsystemsetting)
* [GetTempDirectory](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/gettempdirectory)
* [GetTickCount](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/gettickcount)
* [htmlEditFormat](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/htmleditformat)
* [IIF](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/iif)
* [Invoke](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/invoke)
* [IsInstanceOf](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/isinstanceof)
* [JavaCast](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/javacast)
* [ObjectDeserialize](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/objectdeserialize)
* [ObjectSerialize](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/objectserialize)
* [PagePoolClear](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/pagepoolclear)
* [Print](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/print)
* [Println](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/println)
* [RunThreadInContext](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/runthreadincontext)
* [SessionInvalidate](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/sessioninvalidate)
* [SessionRotate](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/sessionrotate)
* [SessionStartTime](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/sessionstarttime)
* [Sleep](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/sleep)
* [SystemCacheClear](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/systemcacheclear)
* [SystemExecute](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/systemexecute)
* [SystemOutput](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/systemoutput)
* [Throw](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/throw)
* [Trace](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/trace)
* [URLDecode](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/urldecode)
* [URLEncodedFormat](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/urlencodedformat)
* [writeDump](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/writedump)
* [WriteOutput](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/writeoutput)
