In a recently project, I needed a good log system, as usual I looking for any one, no found one, well, no that adjust to my needs, so I wrote LoggerFactory my own logger.

Should fit this (and others) needs:

  1. Easy to use
  2. Extensible
  3. Asynchronous by default using threads
  4. Various outputs by TypeLevel
  5. Custom format outputs

Based on very good loggers as java.util.logging or MacOS Logging, I made LoggerFactory the result was very thin with no more 900+ lines of code, with the features I want for my project and for any other projects what need it.


  Dim logger As LoggerFactory.Logger= LoggerFactory.Get(CurrentMethodName)
  logger.Info "this is a info"
  logger.Debug "this is a debug"
  logger.Trace "this is a trace"
  logger.Error "this is a error"
  logger.Warn "this is a warning"
  logger.Fatal "this is a fatal"


By default console and system.DebugLog are set, you can configure adding a Adder with LoggerFactory.Adders.Append example:

  LoggerFactory.Adders.Append New LoggerFactory.ConsoleAdder(LoggerFactory.LevelType.ALL)
  LoggerFactory.Adders.Append New LoggerFactory.FileLogAdder(LoggerFactory.LevelType.ALL)

In the previous snippet, set one “Addler” for console and other for file, here I explain “Adders”, Adders is for “add” outputs (messages) for each level, or to a file, properties or file. The default Adders are:

  • ConsoleAdder: Outputs for console (only for console proyects)
  • SystemDebugLogAdder: The normal System.DebugLog
  • SystemLogAdder: The System.Log
  • FileLogAdder: Outputs to file

One intetesting thing is we can, for example, set DEBUG outputs to SystemDebugLogAdder, plus ERROR outputs to a file, change the output format also you made you own Adders, You can sub-classing LoggerFactory.Adder and overwrite “Log” method; You can create outputs to, for example, to a database or web service; only setting Adders, no other code change.

Another interesting feature of Adders is setting the output format, like:

  Dim addFile As New LoggerFactory.FileLogAdder(LoggerFactory.LevelType.ALL)
  addFile.Format= "%d"+ TAB+ "%t"+ TAB+ "%l"+ TAB+ "%c"+ TAB+ "[%i]"+ TAB+ "%m"


%d: Date
%t: Time
%l: Level
%c: Counter
%u: SubSystem
%a: Category
%i: ID
%o: ObjectID
%e: EventType
%m: Message

“SEP” is a property of adder, TAB [Chr(9) en ASCII] is default and you can also set.
The FileLogAdder can be set “roll over”, with the FileLogAdder.FileType property and could be: same file, yearly, monthly, daily, hourly or by size.

Last, I talk about “Formatter”, you can use Str() o Format() for format outputs or code as:

  Dim n1 As UInt64= 202002021101
  Dim n2 As Double= 12.3456
  Dim n3 As Single= -12345.6789
  Dim s1 As String= "world"
  logger.Debug "i = %2d, n1= %u, n2= %3.5f, hello %s, single= %-###,##0.0###f - %{pub}s", _
  i, n1, n2, s1, n3, "test"


%d: Signed integers
%u: Unsigned integers
%f: Signed doubles/singles
%s: Strings

Others features are Sub-Systems and nanoseconds precision time, but that is for other post, If you think this is interesting or have questions, please commet it. So long.

DBReport new designer test 01

In my path on rewrite the designer I created two controls: The Canvas and the UndoManager.

For the canvas I see products like SimDesignerCanvas by Matthew Combatti and NaturalScrollingCanvas by Jim McKay, Both are good products but not for me, especially for the cost, I have to “resale” and the cost is same of mine, so I desided write my own, can see a video here.

For the undo I checkout UndoToolkit by Scott Forbes and TheBigUndo by Jim McKay. I was impressed with TheBigUndo, how does he do it? the timer is the answer but… Anyway, BigUndo requires “resale” the license so descarted! by other hand, with UndoToolkit I have the source and is a proved tool, however, for use the Undotoolkit require subclassing, add an interfase, some methods and are ready for undo, not much to do, right? Are there other form to do that? So, before implement the undoToolkit, I search on internet, find the command pattern, the memento pattern and the NSUndoManager, I asked myself: How I wish the undo? maybe one undo with both? command and memento pattern. I think is posible, that’s why I desided write my own UndoManager. It works like NSUndoManager -command pattern- but without subclassing, add methods, etc. And I can add a persistent memento pattern, well, I guess…

I have some problems to resolve but I like the progress.So stay tuned!.

DBReport website

I’m testing a website for DBReport and need feedback.

The site is on beta stage, basically for testing some concepts and speed. The main goals are:

  1. A info website for the product (what is, what do, how get it).
  2. Online documentation (how use it) with video tutorials.
  3. Automate sales by credit-card or paypal.

I’m working on automate sales process for paypal. In this moment I do it manually with an email because the sales are low. Almost all code is written just testing some.

Next thing are credit-card sales. A partner are the best option, FastSpring or Click2Sell, or maybe the next year DBReport are bundle on OmegaBundle, who nows?

Another thing is the designer-rewritten, next month are alpha testing. Right now is just a proof-concept for feel like a  REAL designer.

No more news by now, please visit the site, the doc and tutorials and give me feedback.

Download the last version.



Unit-test for DBReport

Users had issues with subtotal functions. Some reports works others don’t. That’s the more dificult to fix.

That’s unit-tests for, “…take the smallest piece of testable software in the application, isolate it from the remainder of the code, and determine whether it behaves exactly as you expect.

In case of subtotals I have to code some kind of helper function returning the value and check if is equal of a field of query.

I’m preparing a big re-coding (some people called refactoring) so the unit-test are a valuable tool for software quality.

A video unit-test implementation.

By the way, i use sakila db and add demo reports (a +500 pages report!). I will add more.

A video with sakila demo reports.

Something additional, besides solving some bugs, there is support for MBS barcode. At the beginning I chose Simbarcodes of Matthew Combatti for ease of implementation in DBReport and because it is very active in the forum, but Matthew did not answer me an email to buy the component (if Matthew is reading this, please answer: how do I buy?) so I had to implement BarcodeMBS for a client who needed barcode on the reports.

A video BarcodeMBS workflow.

You can download the last version here (mirror).

Good code.

So Long, and Thanks for All the Fish.

DBReport new Release: 1.4

Hi everybody!

New features for this release:

  • HotSpot areas in preview.
  • Listbox property as recordset.
  • Support for barcodes with Simbarcodes.


Hotspot areas in preview allows you process click on areas of view for, by example show a window. The control provides the parameters for select what element and the value.

For programmers asking for use listbox as recorset i add a property:

rpt.Listbox= listbox1

* The headings are using as fields.


Add barcode support with Simbarcodes module. The idea is support more providers like BarcodeGeneratorMBS or J4L-Barcode in the future.

You can see a video here.

You can download the component here or here.

Have a fun code!

DBReport new feature: Render to PDF


Merry Christmas and Happy New Year!

Another Year, another code!

In this time i write about new feature for DBReport: Render to PDF.

I know you can “Print” a report to virtual printer but in some cases you need create PDF files programmatically; by example in WebApp, so i wrote a DBReportPDF class it’s based on other projects i found on internet so is Free to use (don’t need a product key to use) and works alone (don’t need others classes).

Code Example:

Dim rpt As New DBReport(f, rs)
Dim fPDF as FolderItem= SpecialFolder.Desktop.Child( “DBReportExample2.pdf” )
rpt.RenderToPDF fPDF

This are some limitations for DBReportPDF:

  • Fonts may not be embedded. (not fully implemented yet)
  • The Underline property is not yet implemented.

By default it use zlib compression (ready on MacOS and Linux) , zlib1.dll is included on Windows, you need “boundle” this file.

In the future i support DynaPDF for PDF render Engine.

Is possible don’t use DBReportPDF just set constant kRenderEngineDBReportPDF to False on DBReportShared module and delete DBReportPDF* classes.

You can see a video here.

You can download the component here or here.


DBReport new feature: Subreports

Now you can add SubReport element to DBReport.

Sometimes i need print info what are no easy to set in one recordset, so i need various recordsets and “adding” to a report, that is the SubReports are useful.

First, create a report which is a template for a report parent, is not required but is recommendable. Normally just contains a “Detail” band, however you can add bands, save as a normal report definition file.

On a Report, drag’n drop SubReport element to a band, the object assume all band area, but you can change the size; the height is automatically expand as needed when is printed.

Set the template property from properties panel (do not need template file anymore) you can change the SubReport doing click on Subreport tree from “Schema” panel (the Schema button button).

At last, you set the recordset before call “Designer”, “print” or “preview”, with this code:

rpt.SubReport(“NameOfSubReport”).RecordSet= rs

The “NameOfSubreport” must be same as SubReport Name and element Name.

See video here.

You can get the component from here, here or here.

Review the issue tracker at: https://bitbucket.org/lbmonsalve/dbreport/issues

Thanks and have a nice code!

DBReport 1.3 Release

New release for everyone!

This are new:

* Documentation.
* Register component schema.
* Grid and SnapToGrid.
* Print on thread.
* Cache on preview +100 (settable) pages on disk.
* Propierties.
* Translate to German thanks to Rolf Gengster (rgenster@genster.com).
– Changing size of element on MacOS fixed, others bugs fixed.

You get the component on this links:

All comments are welcome.
Best regards.

DBReport for Xojo (IV)

Today I will write about images on DBReport for Xojo.

We use images on DBReport in three ways: as a parameter as RecordSet field or image file.

As a parameter, the parameter is assigned before calling the Designer or Print (“Logo” is an example, may be called as you want):

rpt.Parameter(“Logo”)= PictureObject

In the Designer, Add Picture element, Write “#Logo” in Property Picture.

As RecordSet field: In the Designer adds Pic element, click triangle of Field property and choose the field name.

As file image: Click in the circle with points and choose one file, this file is saved in the report definition, so you do not need more the file.

In this example uses SQLite, but it works with other databases (not used PictureValue)

This video shows how to use images.

This information is provided “As-is”. All trademarks, logos, etc. belong to their respective owners.

DBReport for Xojo (III)

To understand how the DBReport works we need to understand the concept of bands.

A band is a box where we put objects, the most important band is “Detail” which is the only one who can not erase. This (Detail) is printed for each row or record of the RecordSet, ie if we have 10 rows or records we have 10 bands “Detail”.

The band “page header” is printed first in the top of the page for each page in the report generated.

The band “Page footer” is printed on the bottom of the page for each page in the report generated.

The band “Report header” is printed after the band “page header” on the first page of the report.

The band “Report footer” is printed just after the last band printed on the final page of the report.

Group bands are bands that are printed before the band “Detail” like “Group Header” and then like “Group Footer”. They print to change the group (field of recordset) or at the beginning of the report in the case of “Group Header” or end of the report in case of “Group Footer”. You can have as many group bands as needed.

The objects that can be placed in the bands are:

  • Labels: are text like “Title Report” or the system date as “# date” or page number like “#pag” parameters or formulas.
  • Fields: field name as “name” or “id”.
  • Lines: horizontal, vertical or oblique.
  • Rectangles Boxes or rounded rectangles.
  • Images: Can be an image file or a RecordSet field.

This video shows some aspects of above.

The parameters are data (String, Picture, Array …) needed in the report but not in the RecordSet such as company name or username. These are assigned before printing or before displaying the “Designer” with instruction eg:

rpt.Parameter(“Company”)= “Company Name”

This video shows parameters and other things.

This video shows groups.

This information is provided “As-is”. All trademarks, logos, etc. belong to their respective owners.