Appendix¶
SBT Commands¶
Sbt Commands | Comments |
---|---|
smile new <project_Name> | To create a new project in smile. NOTE: First letter of the project name should be Capital ex: smile new Lottery |
smile | Generates the .klang file and dependencies for modules when .ksmile file is modified. |
compile |
|
run | Runs the application |
test-compile | Compiles the Test Classes |
test-only ex: test-only .ClassName – -n TagName | Generates the .klang file and dependencies for modules when .ksmile file is modified. |
clean | Cleans the project files. |
prepare | generates intermediate(xml) file from language (.klang) file only which are touched.. |
prepare-force | Forcibly prepares all the files again. |
generate | Generates only the touched scala code from intermediate(xml) file |
generate-force | Forcibly prepares all the files again. |
prepare-force | Forcibly generates all scala code from intermediate(xml) file |
smile-delete <module-name> | Deletes the smile module |
Module Specific Commands¶
Note
SBT recognises each module as project.
Command | Description |
---|---|
projects | Displays all the modules inside the project |
project <module_name> | To go inside a module. |
Command | Description |
---|---|
drop <collection name> | drops the specified collection |
drop-collections | drops all the collections |
ensure-indices <collection name> | ensure indices for the specified collection |
ensure-all-Indices | ensure indices for all collections |
drop-indices <collection name> | drops indices for the specified collection |
drop-all-indices | drops indices for all collections |
Command | Description |
---|---|
streams | Shows all the streams inside the module. |
streamDetails | Details of the stream. |
streamSetStableSeqNumber | |
streamUpdateStableSeqNumber | |
streamSetEventCounter | |
streamDropResolveCounter | |
streamUpdateResolveEvents | |
streamUpdateResolveEvents | |
streamUpdateRenameEvents | |
streamTruncateStore | |
streamImportEvents | |
streamExportEvents |
Command | Description |
---|---|
projectionDetails | |
projectionUpdate | |
projectionSnapshotCreate | |
projectionSnapshotDelete | |
projectionSnapshotClearStop | |
projectionEventDetails |
Command | Description |
---|---|
run-scipt <script_name> name=value | To run a script. |
Logging¶
Logging API
Using logging in your application can be useful for monitoring, debugging, error tracking, and business intelligence. Smile provides an API for logging which is accessed through the Logger class (very similar to Play Framework Logger object) that uses Logback as the logging engine.
Using Loggers
Smile provides an application logger instance called appLogger in com.iteration3.smile package object. The configuration and appenders are located in application-logger.xml located under conf directory. It also defines a internal logger “smile” for logging from the framework code. You could use appLogger or create application specific loggers as described below.
To use appLogger,
import com.iteration3.smile._
....
appLogger.info("information worth logging");
Creating your own Loggers
Smile provides a API to create your own logger.
val accessLogger = new Logger("access"); // could store it one of the Module level object for easy access.
...
accessLogger.info("accessing something");
Configure the logging level and appenders in application-logger.xml located under conf directory.
Example:
application-logger.xml
<appender name="ACCESS-LOG-FILE" class="ch.qos.logback.core.FileAppender">
<file>${application.home}/logs/download.log</file>
<encoder>
<pattern>%date - %message%n%xException%n</pattern>
</encoder>
</appender>
<logger name="access" level="INFO" additivity="false">
<appender-ref ref="ACCESS-LOG-FILE"/>
<appender-ref ref="STDOUT"/>
</logger>
Environment Specific Logger Configuration
For environment specific logger configuration, create the configuration file as <env-name>.application-logger.xml. For more information on environment specific configuration, look at Environment Specific Configuration